summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerryHowe <terrylhowe@gmail.com>2015-05-01 12:21:08 -0600
committerTerry Howe <terrylhowe@gmail.com>2015-05-07 13:10:06 -0600
commit62bb88f621140670c1c2f26397f97cd87fd66b18 (patch)
tree6c33ffdda39e0c3c27798f01f96c3ebadb35b3d3
parent28f65e665045c1c6d0697f856f06020c7c8e656a (diff)
downloadpython-openstackclient-62bb88f621140670c1c2f26397f97cd87fd66b18.tar.gz
Security group rule delete broken
Nova client was changed to take a rule id for security group rule delete. https://github.com/openstack/python-novaclient/blob/master/novaclient/v2/security_group_rules.py#L72 Change-Id: I0a69f3f196a36f267ee85a651b09aa8d3c328121 Closes-Bug: #1450872
-rw-r--r--doc/source/backwards-incompatible.rst12
-rw-r--r--openstackclient/compute/v2/security_group.py39
2 files changed, 16 insertions, 35 deletions
diff --git a/doc/source/backwards-incompatible.rst b/doc/source/backwards-incompatible.rst
index 817f2a30..437f9324 100644
--- a/doc/source/backwards-incompatible.rst
+++ b/doc/source/backwards-incompatible.rst
@@ -35,6 +35,18 @@ List of Backwards Incompatible Changes
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1404073
* Commit: https://review.openstack.org/#/c/143242/
+3. Command `openstack security group rule delete` now requires rule id
+
+ Previously, the command was `openstack security group rule delete --proto
+ <proto> [--src-ip <ip-address> --dst-port <port-range>] <group>`,
+ whereas now it is: `openstack security group rule delete <rule>`.
+
+ * In favor of: Using `openstack security group rule delete <rule>`.
+ * As of: 1.2.1
+ * Removed in: NA
+ * Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1450872
+ * Commit: https://review.openstack.org/#/c/179446/
+
For Developers
==============
diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py
index 55405810..d860bf80 100644
--- a/openstackclient/compute/v2/security_group.py
+++ b/openstackclient/compute/v2/security_group.py
@@ -328,28 +328,9 @@ class DeleteSecurityGroupRule(command.Command):
def get_parser(self, prog_name):
parser = super(DeleteSecurityGroupRule, self).get_parser(prog_name)
parser.add_argument(
- 'group',
- metavar='<group>',
- help='Security group rule to delete (name or ID)',
- )
- parser.add_argument(
- "--proto",
- metavar="<proto>",
- default="tcp",
- help="IP protocol (icmp, tcp, udp; default: tcp)",
- )
- parser.add_argument(
- "--src-ip",
- metavar="<ip-address>",
- default="0.0.0.0/0",
- help="Source IP (may use CIDR notation; default: 0.0.0.0/0)",
- )
- parser.add_argument(
- "--dst-port",
- metavar="<port-range>",
- action=parseractions.RangeAction,
- help="Destination port, may be a range: 137:139 (default: 0; "
- "only required for proto tcp and udp)",
+ 'rule',
+ metavar='<rule>',
+ help='Security group rule ID to delete',
)
return parser
@@ -357,19 +338,7 @@ class DeleteSecurityGroupRule(command.Command):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute
- group = utils.find_resource(
- compute_client.security_groups,
- parsed_args.group,
- )
- from_port, to_port = parsed_args.dst_port
- # sigh...delete by ID?
- compute_client.security_group_rules.delete(
- group.id,
- parsed_args.proto,
- from_port,
- to_port,
- parsed_args.src_ip,
- )
+ compute_client.security_group_rules.delete(parsed_args.rule)
return