From 4d69976cf79617701c0a5ed86ec1ee6a9acd9c06 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Mon, 2 Oct 2017 12:05:42 -0400 Subject: openshift_checks: Fix incorrect list cast docker_image_availability casted openshift_docker_additional_registries to a list using the list() function. If a string was returned (IE: only a single registry added) the result would be the string split up by component characters. This change forces a string result from get_var to be placed inside a list. If the result is anything BUT a string the original list() function is called on the result. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1497274 Signed-off-by: Steve Milner --- .../openshift_checks/docker_image_availability.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'roles') 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 93a5973d4..fa07c1dde 100644 --- a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py +++ b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py @@ -1,5 +1,6 @@ """Check that required Docker images are available.""" +from ansible.module_utils import six from openshift_checks import OpenShiftCheck from openshift_checks.mixins import DockerHostMixin @@ -153,7 +154,15 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): def known_docker_registries(self): """Build a list of docker registries available according to inventory vars.""" - regs = list(self.get_var("openshift_docker_additional_registries", default=[])) + regs = self.get_var("openshift_docker_additional_registries", default=[]) + # https://bugzilla.redhat.com/show_bug.cgi?id=1497274 + # if the result was a string type, place it into a list. We must do this + # as using list() on a string will split the string into its characters. + if isinstance(regs, six.string_types): + regs = [regs] + else: + # Otherwise cast to a list as was done previously + regs = list(regs) deployment_type = self.get_var("openshift_deployment_type") if deployment_type == "origin" and "docker.io" not in regs: -- cgit v1.2.3