Merge pull request #43061 from pabloh007/fix-save-image-name-id

Have docker.save use the image name when valid if not use image id, i…
This commit is contained in:
Erik Johnson 2017-08-24 11:32:01 -05:00 committed by GitHub
commit e60f586442

View file

@ -3880,8 +3880,9 @@ def save(name,
saved_path = salt.utils.files.mkstemp()
else:
saved_path = path
cmd = ['docker', 'save', '-o', saved_path, inspect_image(name)['Id']]
# use the image name if its valid if not use the image id
image_to_save = name if name in inspect_image(name)['RepoTags'] else inspect_image(name)['Id']
cmd = ['docker', 'save', '-o', saved_path, image_to_save]
time_started = time.time()
result = __salt__['cmd.run_all'](cmd, python_shell=False)
if result['retcode'] != 0: