summaryrefslogtreecommitdiff
path: root/openstackclient/compute
diff options
context:
space:
mode:
authorRichard Theis <rtheis@us.ibm.com>2015-12-04 16:37:40 -0600
committerRichard Theis <rtheis@us.ibm.com>2015-12-07 12:42:10 -0600
commit566388ab1eddd339b054c2046d41e2b01476f4e2 (patch)
tree5cd6bd9c4c4a0e0f6dfb00f1bf24119f66aafabf /openstackclient/compute
parenta207c27fc87595d8f59bb29436b7ccb2243a5682 (diff)
downloadpython-openstackclient-566388ab1eddd339b054c2046d41e2b01476f4e2.tar.gz
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
Diffstat (limited to 'openstackclient/compute')
-rw-r--r--openstackclient/compute/v2/security_group.py12
1 files changed, 10 insertions, 2 deletions
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="<ip-address>",
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="<group>",
+ 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)