diff options
author | Luke Meyer <lmeyer@redhat.com> | 2017-09-11 17:28:28 -0400 |
---|---|---|
committer | Luke Meyer <lmeyer@redhat.com> | 2017-09-12 10:31:45 -0400 |
commit | 9fbd9c25e39eb4e03af71e16ae8184659b056c77 (patch) | |
tree | 3ceebb07ff76516ad0e758bf2de2a1452a8938e1 | |
parent | a3e1c2a819434acc2ce07467c322e12beeee8591 (diff) | |
download | openshift-9fbd9c25e39eb4e03af71e16ae8184659b056c77.tar.gz openshift-9fbd9c25e39eb4e03af71e16ae8184659b056c77.tar.bz2 openshift-9fbd9c25e39eb4e03af71e16ae8184659b056c77.tar.xz openshift-9fbd9c25e39eb4e03af71e16ae8184659b056c77.zip |
docker_image_availability: fix local image search
An image in the docker index may be tagged by name or by registry plus
name. In order to find the image correctly locally and prevent looking
for it externally, make sure all possible variations are searched.
-rw-r--r-- | roles/openshift_health_checker/openshift_checks/docker_image_availability.py | 14 |
1 files changed, 9 insertions, 5 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 4418fd7d5..9c35f0f92 100644 --- a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py +++ b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py @@ -139,10 +139,14 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck): def local_images(self, images): """Filter a list of images and return those available locally.""" - return [ - image for image in images - if self.is_image_local(image) - ] + registries = self.known_docker_registries() + found_images = [] + for image in images: + # docker could have the image name as-is or prefixed with any registry + imglist = [image] + [reg + "/" + image for reg in registries] + if self.is_image_local(imglist): + found_images.append(image) + return found_images def is_image_local(self, image): """Check if image is already in local docker index.""" @@ -151,7 +155,7 @@ 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")) + regs = list(self.get_var("openshift.docker.additional_registries", default=[])) deployment_type = self.get_var("openshift_deployment_type") if deployment_type == "origin" and "docker.io" not in regs: |