diff options
| author | Richard Theis <rtheis@us.ibm.com> | 2016-02-26 11:33:45 -0600 |
|---|---|---|
| committer | Richard Theis <rtheis@us.ibm.com> | 2016-03-10 08:33:52 -0600 |
| commit | 564c8ff2403da87b96562076865f42426a4f8eac (patch) | |
| tree | 6ff87996ca4a35647361d14866dc685dd5fef526 /openstackclient/compute | |
| parent | f8ac17ac52fa42067c881254e243ebe4514624be (diff) | |
| download | python-openstackclient-564c8ff2403da87b96562076865f42426a4f8eac.tar.gz | |
Refactor security group show to use SDK
Refactored the 'os security group show' command to use the SDK
when neutron is enabled, but continue to use the nova client
when nova network is enabled.
Added a release note for the change in security group rules output
due to Network v2. The column names remain unchanged to maintain
backwards compatibility.
Change-Id: I25233ddb8115d18b8b88affb3de13346084a339d
Partial-Bug: #1519511
Implements: blueprint neutron-client
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/security_group.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py index f378af14..042e5caf 100644 --- a/openstackclient/compute/v2/security_group.py +++ b/openstackclient/compute/v2/security_group.py @@ -56,23 +56,6 @@ def _xform_security_group_rule(sgroup): return info -def _xform_and_trim_security_group_rule(sgroup): - info = _xform_security_group_rule(sgroup) - # Trim parent security group ID since caller has this information. - info.pop('parent_group_id', None) - # Trim keys with empty string values. - keys_to_trim = [ - 'ip_protocol', - 'ip_range', - 'port_range', - 'remote_security_group', - ] - for key in keys_to_trim: - if key in info and not info[key]: - info.pop(key) - return info - - class CreateSecurityGroup(command.ShowOne): """Create a new security group""" @@ -215,40 +198,3 @@ class ListSecurityGroupRule(command.Lister): (utils.get_item_properties( s, columns, ) for s in rules)) - - -class ShowSecurityGroup(command.ShowOne): - """Display security group details""" - - def get_parser(self, prog_name): - parser = super(ShowSecurityGroup, self).get_parser(prog_name) - parser.add_argument( - 'group', - metavar='<group>', - help='Security group to display (name or ID)', - ) - return parser - - def take_action(self, parsed_args): - - compute_client = self.app.client_manager.compute - info = {} - info.update(utils.find_resource( - compute_client.security_groups, - parsed_args.group, - )._info) - rules = [] - for r in info['rules']: - formatted_rule = _xform_and_trim_security_group_rule(r) - rules.append(utils.format_dict(formatted_rule)) - - # Format rules into a list of strings - info.update( - {'rules': utils.format_list(rules, separator='\n')} - ) - # Map 'tenant_id' column to 'project_id' - info.update( - {'project_id': info.pop('tenant_id')} - ) - - return zip(*sorted(six.iteritems(info))) |
