Refactor Foreman provider to use simplified img
This commit is contained in:
parent
1664554b4a
commit
5ea1ee47dd
1 changed files with 8 additions and 30 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue