summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
diff options
context:
space:
mode:
authorRodolfo Carvalho <rhcarvalho@gmail.com>2017-03-27 16:08:22 +0200
committerRodolfo Carvalho <rhcarvalho@gmail.com>2017-03-28 11:54:52 +0200
commitd6cf72a4f488d8c275bfbaf27620ff716da1ae5d (patch)
tree403899c70d6406a0fba56d7bfbd92448d5e97bc4 /roles/openshift_health_checker/openshift_checks/docker_image_availability.py
parentca2eaab70716a23d1d8064d16d183cb7f2ffc898 (diff)
downloadopenshift-d6cf72a4f488d8c275bfbaf27620ff716da1ae5d.tar.gz
openshift-d6cf72a4f488d8c275bfbaf27620ff716da1ae5d.tar.bz2
openshift-d6cf72a4f488d8c275bfbaf27620ff716da1ae5d.tar.xz
openshift-d6cf72a4f488d8c275bfbaf27620ff716da1ae5d.zip
Add test scaffold for docker_image_availability.py
The intention is to set a starting point and let another team member work on the code to gain experience with tests.
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks/docker_image_availability.py')
-rw-r--r--roles/openshift_health_checker/openshift_checks/docker_image_availability.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
index 7a7498cb7..cce289b95 100644
--- a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
+++ b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
@@ -15,6 +15,9 @@ class DockerImageAvailability(OpenShiftCheck):
skopeo_image = "openshift/openshift-ansible"
+ # FIXME(juanvallejo): we should consider other possible values of
+ # `deployment_type` (the key here). See
+ # https://github.com/openshift/openshift-ansible/blob/8e26f8c/roles/openshift_repos/vars/main.yml#L7
docker_image_base = {
"origin": {
"repo": "openshift",
@@ -62,9 +65,15 @@ class DockerImageAvailability(OpenShiftCheck):
def required_images(self, task_vars):
deployment_type = get_var(task_vars, "deployment_type")
+ # FIXME(juanvallejo): we should handle gracefully with a proper error
+ # message when given an unexpected value for `deployment_type`.
image_base_name = self.docker_image_base[deployment_type]
openshift_release = get_var(task_vars, "openshift_release")
+ # FIXME(juanvallejo): this variable is not required when the
+ # installation is non-containerized. The example inventories have it
+ # commented out. We should handle gracefully and with a proper error
+ # message when this variable is required and not set.
openshift_image_tag = get_var(task_vars, "openshift_image_tag")
is_containerized = get_var(task_vars, "openshift", "common", "is_containerized")
@@ -104,6 +113,8 @@ class DockerImageAvailability(OpenShiftCheck):
if result.get("failed", False):
return []
+ # FIXME(juanvallejo): wrong default type, result["info"] is expected to
+ # contain a dictionary (see how we call `docker_info.get` below).
docker_info = result.get("info", "")
return [registry.get("Name", "") for registry in docker_info.get("Registries", {})]