mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 02:11:26 -07:00
Backport of https://github.com/ansible-collections/community.docker/pull/87 to stable-1. (#1983)
This commit is contained in:
parent
3d3e47fc87
commit
1e1a843ff3
4 changed files with 25 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue