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

@ -167,7 +167,7 @@ import traceback
try:
from docker import utils
from docker.errors import DockerException
from docker.errors import DockerException, NotFound
except ImportError:
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
pass
@ -215,7 +215,7 @@ class ImageManager(DockerBaseClass):
for name in names:
if is_image_name_id(name):
self.log('Fetching image %s (ID)' % (name))
image = self.client.find_image_by_id(name)
image = self.client.find_image_by_id(name, accept_missing_image=True)
else:
repository, tag = utils.parse_repository_tag(name)
if not tag:
@ -232,6 +232,8 @@ class ImageManager(DockerBaseClass):
for image in images:
try:
inspection = self.client.inspect_image(image['Id'])
except NotFound:
pass
except Exception as exc:
self.fail("Error inspecting image %s - %s" % (image['Id'], str(exc)))
results.append(inspection)