diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2017-10-02 20:53:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-02 20:53:32 -0700 |
commit | 233c5488b68c0392f7e73431cf9d75c5fa9557ec (patch) | |
tree | eb64501233c56f5a278ef0835f3b00f9a63080d9 | |
parent | a148a0f2768e37f212a12c21e6dda4c02b80143c (diff) | |
parent | 4d69976cf79617701c0a5ed86ec1ee6a9acd9c06 (diff) | |
download | openshift-233c5488b68c0392f7e73431cf9d75c5fa9557ec.tar.gz openshift-233c5488b68c0392f7e73431cf9d75c5fa9557ec.tar.bz2 openshift-233c5488b68c0392f7e73431cf9d75c5fa9557ec.tar.xz openshift-233c5488b68c0392f7e73431cf9d75c5fa9557ec.zip |
Merge pull request #5619 from ashcrow/1497274
Automatic merge from submit-queue.
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
Resolves #5610
-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: |