diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-09-08 21:18:06 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-09-08 21:18:06 +0000 |
| commit | b4421e380244ca1c94fca27de9027829b158b6e0 (patch) | |
| tree | 1f8399937526606711d9815702a2b39388b4c5fe /openstackclient/compute | |
| parent | 24ca952eb603e776b60ac282b028d2dc1b9289dd (diff) | |
| parent | e6706f252642e52dd9de556b92edb769afa57868 (diff) | |
| download | python-openstackclient-b4421e380244ca1c94fca27de9027829b158b6e0.tar.gz | |
Merge "Properly handle port arguments for ICMP"
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/security_group.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py index 3dc9bae0..25c2ed3f 100644 --- a/openstackclient/compute/v2/security_group.py +++ b/openstackclient/compute/v2/security_group.py @@ -50,10 +50,10 @@ def _xform_security_group_rule(sgroup): info['ip_range'] = info['ip_range']['cidr'] else: info['ip_range'] = '' - if info['ip_protocol'] == 'icmp': - info['port_range'] = '' - elif info['ip_protocol'] is None: + if info['ip_protocol'] is None: info['ip_protocol'] = '' + elif info['ip_protocol'].lower() == 'icmp': + info['port_range'] = '' return info @@ -307,7 +307,10 @@ class CreateSecurityGroupRule(show.ShowOne): compute_client.security_groups, parsed_args.group, ) - from_port, to_port = parsed_args.dst_port + if parsed_args.proto.lower() == 'icmp': + from_port, to_port = -1, -1 + else: + from_port, to_port = parsed_args.dst_port data = compute_client.security_group_rules.create( group.id, parsed_args.proto, |
