Print image uuid instead of the whole dict

After doing a commit, the CLI will print message like:

  Request to commit container XXX has been accepted.
  The image is {u'uuid': u'XXX'}.

Instead of printing the whole image dict, simply print the uuid
of the image will look better.

Change-Id: I1c60b34e6bb30ee3c10d8ffebc97b7b16ec84e90
This commit is contained in:
Hongbin Lu 2018-02-19 21:18:00 +00:00
parent 755f0a3508
commit 514534e6db
2 changed files with 2 additions and 2 deletions

View File

@ -993,7 +993,7 @@ class CommitContainer(command.Command):
try:
image = client.containers.commit(container, **opts)
print("Request to commit container %s has been accepted. "
"The image is %s." % (container, image))
"The image is %s." % (container, image['uuid']))
except Exception as e:
print("commit container %(container)s failed: %(e)s" %
{'container': container, 'e': e})

View File

@ -714,7 +714,7 @@ def do_commit(cs, args):
try:
image = cs.containers.commit(args.container, **opts)
print("Request to commit container %s has been accepted. "
"The image is %s." % (args.container, image))
"The image is %s." % (args.container, image['uuid']))
except Exception as e:
print("Commit for container %(container)s failed: %(e)s" %
{'container': args.container, 'e': e})