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:
Erik Johnson 2015-09-29 08:49:46 -05:00
commit f3da6e4bb3

View file

@ -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