diff options
author | Steve Milner <smilner@redhat.com> | 2017-10-02 12:05:42 -0400 |
---|---|---|
committer | Steve Milner <smilner@redhat.com> | 2017-10-02 13:02:29 -0400 |
commit | 4d69976cf79617701c0a5ed86ec1ee6a9acd9c06 (patch) | |
tree | 14938799c847c172d6db90d4e95280b9176b8df0 /roles/openshift_health_checker | |
parent | e54cb2611e86c43650512ee3afee2c6ce846b064 (diff) | |
download | openshift-4d69976cf79617701c0a5ed86ec1ee6a9acd9c06.tar.gz openshift-4d69976cf79617701c0a5ed86ec1ee6a9acd9c06.tar.bz2 openshift-4d69976cf79617701c0a5ed86ec1ee6a9acd9c06.tar.xz openshift-4d69976cf79617701c0a5ed86ec1ee6a9acd9c06.zip |
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 <smilner@redhat.com>
Diffstat (limited to 'roles/openshift_health_checker')
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/docker_image_availability.py | 11 |
1 files changed, 10 insertions, 1 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 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: |