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_NAME = 'foreman-stub'
|
||||||
DOCKER_SIMULATOR_IMAGE_NAME = 'ansible/foreman-test-container'
|
|
||||||
DOCKER_SIMULATOR_IMAGE_TAG = '1.0.0'
|
|
||||||
|
|
||||||
DOCKER_IMAGES = {
|
DOCKER_IMAGE = 'quay.io/ansible/foreman-test-container:1.3.1'
|
||||||
'hub': {
|
"""Default image to run Foreman stub from.
|
||||||
'registry_url': 'registry.hub.docker.com',
|
|
||||||
'img_name': DOCKER_SIMULATOR_IMAGE_NAME,
|
The simulator must be pinned to a specific version
|
||||||
'img_tag': DOCKER_SIMULATOR_IMAGE_TAG,
|
to guarantee CI passes with the version used.
|
||||||
},
|
|
||||||
'quay': {
|
|
||||||
'registry_url': 'quay.io',
|
|
||||||
'img_name': DOCKER_SIMULATOR_IMAGE_NAME,
|
|
||||||
'img_tag': DOCKER_SIMULATOR_IMAGE_TAG,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
"""Image registry to pull Foreman stub from.
|
|
||||||
|
|
||||||
It's source source itself resides at:
|
It's source source itself resides at:
|
||||||
https://github.com/ansible/foreman-test-container
|
https://github.com/ansible/foreman-test-container
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DOCKER_REGISTRY = 'quay'
|
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
"""Set up container references for provider.
|
"""Set up container references for provider.
|
||||||
|
|
||||||
|
@ -64,21 +52,11 @@ class ForemanProvider(CloudProvider):
|
||||||
self.__container_from_env = os.getenv('ANSIBLE_FRMNSIM_CONTAINER')
|
self.__container_from_env = os.getenv('ANSIBLE_FRMNSIM_CONTAINER')
|
||||||
"""Overrides target container, might be used for development.
|
"""Overrides target container, might be used for development.
|
||||||
|
|
||||||
Use ANSIBLE_FRMNSIM_CONTAINER={hub|quay|whatever_you_want} if you want
|
Use ANSIBLE_FRMNSIM_CONTAINER=whatever_you_want if you want
|
||||||
to be explicit. Omit/empty otherwise.
|
to use other image. Omit/empty otherwise.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
image_src = self.DOCKER_IMAGES.get(self.__container_from_env, {})
|
self.image = self.__container_from_env or self.DOCKER_IMAGE
|
||||||
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.container_name = ''
|
self.container_name = ''
|
||||||
|
|
||||||
def filter(self, targets, exclude):
|
def filter(self, targets, exclude):
|
||||||
|
|
Loading…
Reference in a new issue