From 5ea1ee47dddc0b9e36141f782fc371656fa99999 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 4 Apr 2018 12:02:03 +0200 Subject: [PATCH] Refactor Foreman provider to use simplified img --- test/runner/lib/cloud/foreman.py | 40 +++++++------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/test/runner/lib/cloud/foreman.py b/test/runner/lib/cloud/foreman.py index cc096a41ab5..aee1a5f0686 100644 --- a/test/runner/lib/cloud/foreman.py +++ b/test/runner/lib/cloud/foreman.py @@ -31,29 +31,17 @@ class ForemanProvider(CloudProvider): """ DOCKER_SIMULATOR_NAME = 'foreman-stub' - DOCKER_SIMULATOR_IMAGE_NAME = 'ansible/foreman-test-container' - DOCKER_SIMULATOR_IMAGE_TAG = '1.0.0' - - DOCKER_IMAGES = { - 'hub': { - 'registry_url': 'registry.hub.docker.com', - 'img_name': DOCKER_SIMULATOR_IMAGE_NAME, - 'img_tag': DOCKER_SIMULATOR_IMAGE_TAG, - }, - 'quay': { - 'registry_url': 'quay.io', - 'img_name': DOCKER_SIMULATOR_IMAGE_NAME, - 'img_tag': DOCKER_SIMULATOR_IMAGE_TAG, - }, - } - """Image registry to pull Foreman stub from. + + DOCKER_IMAGE = 'quay.io/ansible/foreman-test-container:1.3.1' + """Default image to run Foreman stub from. + + The simulator must be pinned to a specific version + to guarantee CI passes with the version used. It's source source itself resides at: https://github.com/ansible/foreman-test-container """ - DOCKER_REGISTRY = 'quay' - def __init__(self, args): """Set up container references for provider. @@ -64,21 +52,11 @@ class ForemanProvider(CloudProvider): self.__container_from_env = os.getenv('ANSIBLE_FRMNSIM_CONTAINER') """Overrides target container, might be used for development. - Use ANSIBLE_FRMNSIM_CONTAINER={hub|quay|whatever_you_want} if you want - to be explicit. Omit/empty otherwise. + Use ANSIBLE_FRMNSIM_CONTAINER=whatever_you_want if you want + to use other image. Omit/empty otherwise. """ - image_src = self.DOCKER_IMAGES.get(self.__container_from_env, {}) - if not image_src and self.__container_from_env: - self.image = self.__container_from_env - else: - self.image = ( - # The simulator must be pinned to a specific version - # to guarantee CI passes with the version used: - '{registry_url}/{img_name}:{img_tag}' - ).format( - **(image_src or self.DOCKER_IMAGES[self.DOCKER_REGISTRY]) - ) + self.image = self.__container_from_env or self.DOCKER_IMAGE self.container_name = '' def filter(self, targets, exclude):