mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Backport of https://github.com/ansible-collections/community.docker/pull/87 to stable-1. (#1983)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user