Error in the return of command server show, create

The raw output in the command 'openstack server create'(also in show) is
used in display table directily. the item like
os-extended-volumes:volumes_attached and security_groups needs to convert.

the worry output:
  os-extended-volumes:volumes_attached | [{u'id': u'c3525de9-1cbf-4ac8-8b7a-ca295c46633b'}]
  security_groups                      | [{u'name': u'default'}]

Change-Id: Id9db251c315f989e1dc5b1b6231ab328014213e3
This commit is contained in:
jiahui.qiang 2017-01-17 17:42:15 +08:00
parent 64c509cf76
commit 89d9449dcf

View File

@ -144,6 +144,20 @@ def _prep_server_detail(compute_client, server):
except Exception:
info['flavor'] = flavor_id
if 'os-extended-volumes:volumes_attached' in info:
info.update(
{
'volumes_attached': utils.format_list_of_dicts(
info.pop('os-extended-volumes:volumes_attached'))
}
)
if 'security_groups' in info:
info.update(
{
'security_groups': utils.format_list_of_dicts(
info.pop('security_groups'))
}
)
# NOTE(dtroyer): novaclient splits these into separate entries...
# Format addresses in a useful way
info['addresses'] = _format_servers_list_networks(server.networks)