This commit is contained in:
Felix Fontein 2021-03-08 08:37:04 +01:00 committed by GitHub
parent 3d3e47fc87
commit 1e1a843ff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 5 deletions

View file

@ -636,6 +636,9 @@ class AnsibleDockerClient(Client):
if len(images) == 1:
try:
inspection = self.inspect_image(images[0]['Id'])
except NotFound:
self.log("Image %s:%s not found." % (name, tag))
return None
except Exception as exc:
self.fail("Error inspecting image %s:%s - %s" % (name, tag, str(exc)))
return inspection
@ -643,7 +646,7 @@ class AnsibleDockerClient(Client):
self.log("Image %s:%s not found." % (name, tag))
return None
def find_image_by_id(self, image_id):
def find_image_by_id(self, image_id, accept_missing_image=False):
'''
Lookup an image (by ID) and return the inspection results.
'''
@ -653,6 +656,11 @@ class AnsibleDockerClient(Client):
self.log("Find image %s (by ID)" % image_id)
try:
inspection = self.inspect_image(image_id)
except NotFound as exc:
if not accept_missing_image:
self.fail("Error inspecting image ID %s - %s" % (image_id, str(exc)))
self.log("Image %s not found." % image_id)
return None
except Exception as exc:
self.fail("Error inspecting image ID %s - %s" % (image_id, str(exc)))
return inspection