Make SetSecurityGroup inherit from cliff.Command
set/unset comamnd classes should inherit from cliff.Command class. Change-Id: Ie28711ac8823dc9eb13cf83877864ca436b928bc Partial-Bug: 1546065
This commit is contained in:
parent
f37eda3a27
commit
859bfaf875
@ -126,6 +126,18 @@ List of Backwards Incompatible Changes
|
||||
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1546065
|
||||
* Commit: https://review.openstack.org/#/c/280663/
|
||||
|
||||
10. `security group set` commands will no longer return the modified resource
|
||||
|
||||
Previously, modifying a security group would result in the new security group
|
||||
being displayed to the user. To keep things consistent with other `set`
|
||||
commands, we will no longer be showing the modified resource.
|
||||
|
||||
* In favor of: Use `set` then `show`
|
||||
* As of: NA
|
||||
* Removed in: NA
|
||||
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1546065
|
||||
* Commit: https://review.openstack.org/#/c/281087/
|
||||
|
||||
For Developers
|
||||
==============
|
||||
|
||||
|
@ -32,10 +32,9 @@ class SecurityGroupTests(test.TestCase):
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
# Rename test
|
||||
opts = cls.get_show_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack('security group set --name ' +
|
||||
cls.OTHER_NAME + ' ' + cls.NAME + opts)
|
||||
cls.assertOutput(cls.OTHER_NAME + "\n", raw_output)
|
||||
cls.OTHER_NAME + ' ' + cls.NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete test
|
||||
raw_output = cls.openstack('security group delete ' + cls.OTHER_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
@ -46,10 +45,14 @@ class SecurityGroupTests(test.TestCase):
|
||||
self.assertIn(self.NAME, raw_output)
|
||||
|
||||
def test_security_group_set(self):
|
||||
opts = self.get_show_opts(['description', 'name'])
|
||||
raw_output = self.openstack('security group set --description NSA ' +
|
||||
self.NAME + opts)
|
||||
self.assertEqual("NSA\n" + self.NAME + "\n", raw_output)
|
||||
raw_output = self.openstack(
|
||||
'security group set --description NSA ' + self.NAME
|
||||
)
|
||||
self.assertEqual('', raw_output)
|
||||
|
||||
opts = self.get_show_opts(['description'])
|
||||
raw_output = self.openstack('security group show ' + self.NAME + opts)
|
||||
self.assertEqual("NSA\n", raw_output)
|
||||
|
||||
def test_security_group_show(self):
|
||||
opts = self.get_show_opts(self.FIELDS)
|
||||
|
@ -271,7 +271,7 @@ class ListSecurityGroupRule(command.Lister):
|
||||
) for s in rules))
|
||||
|
||||
|
||||
class SetSecurityGroup(command.ShowOne):
|
||||
class SetSecurityGroup(command.Command):
|
||||
"""Set security group properties"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
@ -294,7 +294,6 @@ class SetSecurityGroup(command.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
||||
compute_client = self.app.client_manager.compute
|
||||
data = utils.find_resource(
|
||||
compute_client.security_groups,
|
||||
@ -306,17 +305,11 @@ class SetSecurityGroup(command.ShowOne):
|
||||
if parsed_args.description:
|
||||
data.description = parsed_args.description
|
||||
|
||||
info = {}
|
||||
info.update(compute_client.security_groups.update(
|
||||
compute_client.security_groups.update(
|
||||
data,
|
||||
data.name,
|
||||
data.description,
|
||||
)._info)
|
||||
|
||||
if info:
|
||||
return zip(*sorted(six.iteritems(info)))
|
||||
else:
|
||||
return ({}, {})
|
||||
)
|
||||
|
||||
|
||||
class ShowSecurityGroup(command.ShowOne):
|
||||
|
@ -2,3 +2,5 @@
|
||||
fixes:
|
||||
- Command ``flavor set/unset`` now outputs nothing.
|
||||
[Bug `1546065 <https://bugs.launchpad.net/python-openstackclient/+bug/1546065>`_]
|
||||
- Command ``security group set`` now outputs nothing.
|
||||
[Bug `1546065 <https://bugs.launchpad.net/python-openstackclient/+bug/1546065>`_]
|
||||
|
Loading…
Reference in New Issue
Block a user