diff options
| author | Zuul <zuul@review.opendev.org> | 2020-04-08 08:31:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2020-04-08 08:31:28 +0000 |
| commit | 78b18030b5aaa42d7b438d73cb8d1170869ec758 (patch) | |
| tree | 4db7ee7730f1923bd2accff88a055bee8dabbfcc /openstackclient/network/v2/security_group.py | |
| parent | 74a7c1d9d6efc545676cec1d9efeb2a86c5bc548 (diff) | |
| parent | 5e62411e5f6c5b68512d1f72470b4222199eb456 (diff) | |
| download | python-openstackclient-78b18030b5aaa42d7b438d73cb8d1170869ec758.tar.gz | |
Merge "Support for stateless security groups"
Diffstat (limited to 'openstackclient/network/v2/security_group.py')
| -rw-r--r-- | openstackclient/network/v2/security_group.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/openstackclient/network/v2/security_group.py b/openstackclient/network/v2/security_group.py index 2033af14..aec9c56e 100644 --- a/openstackclient/network/v2/security_group.py +++ b/openstackclient/network/v2/security_group.py @@ -120,6 +120,19 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne): metavar='<project>', help=self.enhance_help_neutron(_("Owner's project (name or ID)")) ) + stateful_group = parser.add_mutually_exclusive_group() + stateful_group.add_argument( + "--stateful", + action='store_true', + default=None, + help=_("Security group is stateful (Default)") + ) + stateful_group.add_argument( + "--stateless", + action='store_true', + default=None, + help=_("Security group is stateless") + ) identity_common.add_project_domain_option_to_parser( parser, enhance_help=self.enhance_help_neutron) _tag.add_tag_option_to_parser_for_create( @@ -138,6 +151,10 @@ class CreateSecurityGroup(common.NetworkAndComputeShowOne): attrs = {} attrs['name'] = parsed_args.name attrs['description'] = self._get_description(parsed_args) + if parsed_args.stateful: + attrs['stateful'] = True + if parsed_args.stateless: + attrs['stateful'] = False if parsed_args.project is not None: identity_client = self.app.client_manager.identity project_id = identity_common.find_project( @@ -315,6 +332,19 @@ class SetSecurityGroup(common.NetworkAndComputeCommand): metavar="<description>", help=_("New security group description") ) + stateful_group = parser.add_mutually_exclusive_group() + stateful_group.add_argument( + "--stateful", + action='store_true', + default=None, + help=_("Security group is stateful (Default)") + ) + stateful_group.add_argument( + "--stateless", + action='store_true', + default=None, + help=_("Security group is stateless") + ) return parser def update_parser_network(self, parser): @@ -331,6 +361,10 @@ class SetSecurityGroup(common.NetworkAndComputeCommand): attrs['name'] = parsed_args.name if parsed_args.description is not None: attrs['description'] = parsed_args.description + if parsed_args.stateful: + attrs['stateful'] = True + if parsed_args.stateless: + attrs['stateful'] = False # NOTE(rtheis): Previous behavior did not raise a CommandError # if there were no updates. Maintain this behavior and issue # the update. |
