diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-09-16 03:44:24 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-09-16 03:44:24 +0000 |
commit | ce115063bbde435156132eb4a590e4593541e40e (patch) | |
tree | f9a40124338bd0c9e15a54c12ae6eb5ea076ad08 | |
parent | 915e9161a6b269d1ef463e8883b0c52fb3f5867c (diff) | |
parent | 3d68063809547e37f862dba448dcf669b7a4445c (diff) | |
download | python-novaclient-2.19.0.tar.gz |
Merge "Don't display duplicated security groups"2.19.0
-rw-r--r-- | novaclient/v1_1/shell.py | 7 | ||||
-rw-r--r-- | novaclient/v3/shell.py | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py index 662cb51b..4f82b02c 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v1_1/shell.py @@ -1626,8 +1626,11 @@ def _print_server(cs, args, server=None): flavor_id) if 'security_groups' in info: - info['security_groups'] = \ - ', '.join(group['name'] for group in info['security_groups']) + # when we have multiple nics the info will include the + # security groups N times where N == number of nics. Be nice + # and only display it once. + info['security_groups'] = ', '.join( + sorted(set(group['name'] for group in info['security_groups']))) image = info.get('image', {}) if image: diff --git a/novaclient/v3/shell.py b/novaclient/v3/shell.py index a50e1a5a..15026604 100644 --- a/novaclient/v3/shell.py +++ b/novaclient/v3/shell.py @@ -1334,6 +1334,13 @@ def _print_server(cs, args, server=None): info['flavor'] = '%s (%s)' % (_find_flavor(cs, flavor_id).name, flavor_id) + if 'security_groups' in info: + # when we have multiple nics the info will include the + # security groups N times where N == number of nics. Be nice + # and only display it once. + info['security_groups'] = ', '.join( + sorted(set(group['name'] for group in info['security_groups']))) + image = info.get('image', {}) if image: image_id = image.get('id', '') |