Remove 'public' and 'private' parameters in fwaas_v2

The 'public' and 'private' parameters have been replaced
with 'share' and 'no-share' parameters in the Pike version,
they can be removed now.

Change-Id: I57a2e228ec1cdb6ed259914abc38bdada036d369
This commit is contained in:
zhanghao2
2019-10-01 05:19:34 -04:00
parent f61cd94e11
commit ee08644c5f
5 changed files with 15 additions and 82 deletions

View File

@@ -77,19 +77,6 @@ def _get_common_parser(parser):
action='store_true',
help=_('Detach egress firewall policy from the firewall group'))
shared_group = parser.add_mutually_exclusive_group()
shared_group.add_argument(
'--public',
action='store_true',
help=_('Make the firewall group public, which allows it to be '
'used in all projects (as opposed to the default, '
'which is to restrict its use to the current project). '
'This option is deprecated and would be removed in R release.'))
shared_group.add_argument(
'--private',
action='store_true',
help=_('Restrict use of the firewall group to the '
'current project. This option is deprecated '
'and would be removed in R release.'))
shared_group.add_argument(
'--share',
@@ -147,9 +134,9 @@ def _get_common_attrs(client_manager, parsed_args, is_create=True):
cmd_resource=const.CMD_FWP)['id']
elif parsed_args.no_egress_firewall_policy:
attrs['egress_firewall_policy_id'] = None
if parsed_args.share or parsed_args.public:
if parsed_args.share:
attrs['shared'] = True
if parsed_args.no_share or parsed_args.private:
if parsed_args.no_share:
attrs['shared'] = False
if parsed_args.enable:
attrs['admin_state_up'] = True
@@ -349,14 +336,6 @@ class UnsetFirewallGroup(command.Command):
dest='egress_firewall_policy',
help=_('Egress firewall policy (name or ID) to delete'))
shared_group = parser.add_mutually_exclusive_group()
shared_group.add_argument(
'--public',
action='store_true',
help=_('Make the firewall group public, which allows it to be '
'used in all projects (as opposed to the default, '
'which is to restrict its use to the current project). '
'This option is deprecated and would be removed in R'
' release.'))
shared_group.add_argument(
'--share',
action='store_true',
@@ -375,7 +354,7 @@ class UnsetFirewallGroup(command.Command):
attrs['ingress_firewall_policy_id'] = None
if parsed_args.egress_firewall_policy:
attrs['egress_firewall_policy_id'] = None
if parsed_args.share or parsed_args.public:
if parsed_args.share:
attrs['shared'] = False
if parsed_args.enable:
attrs['admin_state_up'] = False

View File

@@ -80,9 +80,9 @@ def _get_common_attrs(client_manager, parsed_args, is_create=True):
attrs['name'] = str(parsed_args.name)
if parsed_args.description:
attrs['description'] = str(parsed_args.description)
if parsed_args.share or parsed_args.public:
if parsed_args.share:
attrs['shared'] = True
if parsed_args.no_share or parsed_args.private:
if parsed_args.no_share:
attrs['shared'] = False
return attrs
@@ -107,19 +107,6 @@ def _get_common_parser(parser):
help=_('Share the firewall policy to be used in all projects '
'(by default, it is restricted to be used by the '
'current project).'))
shared_group.add_argument(
'--public',
action='store_true',
help=_('Make the firewall policy public, which allows it to be '
'used in all projects (as opposed to the default, which '
'is to restrict its use to the current project.) This '
'option is deprecated and would be removed in R release.'))
shared_group.add_argument(
'--private',
action='store_true',
help=_(
'Restrict use of the firewall policy to the current project.'
'This option is deprecated and would be removed in R release.'))
shared_group.add_argument(
'--no-share',
action='store_true',
@@ -403,12 +390,6 @@ class UnsetFirewallPolicy(command.Command):
action='store_true',
help=_('Restrict use of the firewall policy to the '
'current project'))
parser.add_argument(
'--public',
action='store_true',
help=_('Restrict use of the firewall policy to the '
'current project. This option is deprecated '
'and would be removed in R release.'))
return parser
def _get_attrs(self, client_manager, parsed_args):
@@ -428,7 +409,7 @@ class UnsetFirewallPolicy(command.Command):
attrs[const.FWRS] = []
if parsed_args.audited:
attrs['audited'] = False
if parsed_args.share or parsed_args.public:
if parsed_args.share:
attrs['shared'] = False
return attrs

View File

@@ -117,19 +117,6 @@ def _get_common_parser(parser):
action='store_true',
help=_('Detach destination port number or range'))
shared_group = parser.add_mutually_exclusive_group()
shared_group.add_argument(
'--public',
action='store_true',
help=_('Make the firewall policy public, which allows it to be '
'used in all projects (as opposed to the default, '
'which is to restrict its use to the current project). '
'This option is deprecated and would be removed in R Release'))
shared_group.add_argument(
'--private',
action='store_true',
help=_(
'Restrict use of the firewall rule to the current project.'
'This option is deprecated and would be removed in R release.'))
shared_group.add_argument(
'--share',
action='store_true',
@@ -212,9 +199,9 @@ def _get_common_attrs(client_manager, parsed_args, is_create=True):
attrs['enabled'] = True
if parsed_args.disable_rule:
attrs['enabled'] = False
if parsed_args.share or parsed_args.public:
if parsed_args.share:
attrs['shared'] = True
if parsed_args.no_share or parsed_args.private:
if parsed_args.no_share:
attrs['shared'] = False
if parsed_args.source_firewall_group:
attrs['source_firewall_group_id'] = client.find_resource(
@@ -416,12 +403,6 @@ class UnsetFirewallRule(command.Command):
'--share',
action='store_true',
help=_('Restrict use of the firewall rule to the current project'))
parser.add_argument(
'--public',
action='store_true',
help=_('Restrict use of the firewall rule to the current project. '
'This option is deprecated and would be removed in '
'R Release.'))
parser.add_argument(
'--enable-rule',
action='store_true',
@@ -448,7 +429,7 @@ class UnsetFirewallRule(command.Command):
attrs['destination_ip_address'] = None
if parsed_args.destination_port:
attrs['destination_port'] = None
if parsed_args.share or parsed_args.public:
if parsed_args.share:
attrs['shared'] = False
if parsed_args.enable_rule:
attrs['enabled'] = False

View File

@@ -120,20 +120,6 @@ class TestSetFWaaS(test_fakes.TestNeutronClientOSCV2):
target, {self.res: {'shared': True}})
self.assertIsNone(result)
def test_set_public(self):
target = self.resource['id']
arglist = [target, '--public']
verifylist = [
(self.res, target),
('public', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
self.mocked.assert_called_once_with(
target, {self.res: {'shared': True}})
self.assertIsNone(result)
def test_set_duplicate_shared(self):
target = self.resource['id']
arglist = [target, '--share', '--share']

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
The deprecated options ``--public`` and ``--private`` were
dropped in FWaaS v2 related commands. Use ``--share`` and
``--no-share`` instead.