From 566388ab1eddd339b054c2046d41e2b01476f4e2 Mon Sep 17 00:00:00 2001 From: Richard Theis Date: Fri, 4 Dec 2015 16:37:40 -0600 Subject: Add source security group support to create rule The 'security group rule create' command was updated to support a source security group. Now either a source IP address block or source security group can be specified when creating a rule. The default remains the same. Change-Id: If57de2871810caddeeaee96482eb34146968e173 Closes-Bug: #1522969 --- openstackclient/compute/v2/security_group.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py index 6d38195c..8844f5cc 100644 --- a/openstackclient/compute/v2/security_group.py +++ b/openstackclient/compute/v2/security_group.py @@ -111,11 +111,18 @@ class CreateSecurityGroupRule(show.ShowOne): default="tcp", help="IP protocol (icmp, tcp, udp; default: tcp)", ) - parser.add_argument( + source_group = parser.add_mutually_exclusive_group() + source_group.add_argument( "--src-ip", metavar="", default="0.0.0.0/0", - help="Source IP (may use CIDR notation; default: 0.0.0.0/0)", + help="Source IP address block (may use CIDR notation; default: " + "0.0.0.0/0)", + ) + source_group.add_argument( + "--src-group", + metavar="", + help="Source security group (ID only)", ) parser.add_argument( "--dst-port", @@ -145,6 +152,7 @@ class CreateSecurityGroupRule(show.ShowOne): from_port, to_port, parsed_args.src_ip, + parsed_args.src_group, ) info = _xform_security_group_rule(data._info) -- cgit v1.2.1