Merge pull request #37198 from t2b/issue-36587-v2

don't pull image in dockerng.running if test=true
This commit is contained in:
Mike Place 2016-10-27 15:30:09 +09:00 committed by GitHub
commit c0ca1a3e0d

View File

@ -1579,7 +1579,7 @@ def running(name,
except TypeError:
image = ':'.join(_get_repo_tag(str(image)))
if image not in __salt__['dockerng.list_tags']():
if image not in __salt__['dockerng.list_tags']() and not __opts__['test']:
try:
# Pull image
pull_result = __salt__['dockerng.pull'](
@ -1593,7 +1593,12 @@ def running(name,
else:
ret['changes']['image'] = pull_result
image_id = __salt__['dockerng.inspect_image'](image)['Id']
try:
image_id = __salt__['dockerng.inspect_image'](image)['Id']
except CommandExecutionError:
if not __opts__['test']:
raise
image_id = None
if name not in __salt__['dockerng.list_containers'](all=True):
pre_config = {}
@ -1724,7 +1729,11 @@ def running(name,
)
else:
ret['result'] = None
ret['comment'] = 'Container \'{0}\' will be '.format(name)
if image_id is None:
ret['comment'] = 'Image \'{0}\' will be pulled. '.format(image)
else:
ret['comment'] = ''
ret['comment'] += 'Container \'{0}\' will be '.format(name)
if pre_config and force:
ret['comment'] += 'forcibly replaced'
else: