From 89d9449dcfd4679e8d786c73df4be67af8e3b04a Mon Sep 17 00:00:00 2001 From: "jiahui.qiang" Date: Tue, 17 Jan 2017 17:42:15 +0800 Subject: [PATCH] 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 --- openstackclient/compute/v2/server.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index d92218734f..798d3d3fcf 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -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)