Clean up image-show

- parse server entity to just an id
- parse metadata out into separate rows

Change-Id: I8927b148714a7f5ed64bbb74bd79193e258cb34d
This commit is contained in:
Brian Waldon 2011-12-07 11:40:45 -05:00
parent 9067f26077
commit f866c6ec3f

@ -360,9 +360,27 @@ def do_image_meta(cs, args):
def _print_image(image):
links = image.links
info = image._info.copy()
# ignore links, we don't need to present those
info.pop('links')
# try to replace a server entity to just an id
server = info.pop('server', None)
try:
info['server'] = server['id']
except (KeyError, TypeError):
pass
# break up metadata and display each on its own row
metadata = info.pop('metadata', {})
try:
for key, value in metadata.items():
_key = 'metadata %s' % key
info[_key] = value
except AttributeError:
pass
utils.print_dict(info)