mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #27497 from blueyed/dockerng-fix-404-private-forced
dockerng: fix image_present for forced, non-existent image
This commit is contained in:
commit
f3da6e4bb3
1 changed files with 11 additions and 10 deletions
|
@ -446,17 +446,18 @@ def image_present(name,
|
|||
image = ':'.join(_get_repo_tag(name))
|
||||
all_tags = __salt__['dockerng.list_tags']()
|
||||
|
||||
if image in all_tags and not force:
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'Image \'{0}\' already present'.format(name)
|
||||
return ret
|
||||
elif force:
|
||||
try:
|
||||
image_info = __salt__['dockerng.inspect_image'](name)
|
||||
except Exception as exc:
|
||||
ret['comment'] = \
|
||||
'Unable to get info for image \'{0}\': {1}'.format(name, exc)
|
||||
if image in all_tags:
|
||||
if not force:
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'Image \'{0}\' already present'.format(name)
|
||||
return ret
|
||||
else:
|
||||
try:
|
||||
image_info = __salt__['dockerng.inspect_image'](name)
|
||||
except Exception as exc:
|
||||
ret['comment'] = \
|
||||
'Unable to get info for image \'{0}\': {1}'.format(name, exc)
|
||||
return ret
|
||||
else:
|
||||
image_info = None
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue