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
|
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1546065
|
||||||
* Commit: https://review.openstack.org/#/c/280663/
|
* 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
|
For Developers
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
@ -32,10 +32,9 @@ class SecurityGroupTests(test.TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
# Rename test
|
# Rename test
|
||||||
opts = cls.get_show_opts(cls.FIELDS)
|
|
||||||
raw_output = cls.openstack('security group set --name ' +
|
raw_output = cls.openstack('security group set --name ' +
|
||||||
cls.OTHER_NAME + ' ' + cls.NAME + opts)
|
cls.OTHER_NAME + ' ' + cls.NAME)
|
||||||
cls.assertOutput(cls.OTHER_NAME + "\n", raw_output)
|
cls.assertOutput('', raw_output)
|
||||||
# Delete test
|
# Delete test
|
||||||
raw_output = cls.openstack('security group delete ' + cls.OTHER_NAME)
|
raw_output = cls.openstack('security group delete ' + cls.OTHER_NAME)
|
||||||
cls.assertOutput('', raw_output)
|
cls.assertOutput('', raw_output)
|
||||||
@ -46,10 +45,14 @@ class SecurityGroupTests(test.TestCase):
|
|||||||
self.assertIn(self.NAME, raw_output)
|
self.assertIn(self.NAME, raw_output)
|
||||||
|
|
||||||
def test_security_group_set(self):
|
def test_security_group_set(self):
|
||||||
opts = self.get_show_opts(['description', 'name'])
|
raw_output = self.openstack(
|
||||||
raw_output = self.openstack('security group set --description NSA ' +
|
'security group set --description NSA ' + self.NAME
|
||||||
self.NAME + opts)
|
)
|
||||||
self.assertEqual("NSA\n" + self.NAME + "\n", raw_output)
|
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):
|
def test_security_group_show(self):
|
||||||
opts = self.get_show_opts(self.FIELDS)
|
opts = self.get_show_opts(self.FIELDS)
|
||||||
|
@ -271,7 +271,7 @@ class ListSecurityGroupRule(command.Lister):
|
|||||||
) for s in rules))
|
) for s in rules))
|
||||||
|
|
||||||
|
|
||||||
class SetSecurityGroup(command.ShowOne):
|
class SetSecurityGroup(command.Command):
|
||||||
"""Set security group properties"""
|
"""Set security group properties"""
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
@ -294,7 +294,6 @@ class SetSecurityGroup(command.ShowOne):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
|
||||||
compute_client = self.app.client_manager.compute
|
compute_client = self.app.client_manager.compute
|
||||||
data = utils.find_resource(
|
data = utils.find_resource(
|
||||||
compute_client.security_groups,
|
compute_client.security_groups,
|
||||||
@ -306,17 +305,11 @@ class SetSecurityGroup(command.ShowOne):
|
|||||||
if parsed_args.description:
|
if parsed_args.description:
|
||||||
data.description = parsed_args.description
|
data.description = parsed_args.description
|
||||||
|
|
||||||
info = {}
|
compute_client.security_groups.update(
|
||||||
info.update(compute_client.security_groups.update(
|
|
||||||
data,
|
data,
|
||||||
data.name,
|
data.name,
|
||||||
data.description,
|
data.description,
|
||||||
)._info)
|
)
|
||||||
|
|
||||||
if info:
|
|
||||||
return zip(*sorted(six.iteritems(info)))
|
|
||||||
else:
|
|
||||||
return ({}, {})
|
|
||||||
|
|
||||||
|
|
||||||
class ShowSecurityGroup(command.ShowOne):
|
class ShowSecurityGroup(command.ShowOne):
|
||||||
|
@ -2,3 +2,5 @@
|
|||||||
fixes:
|
fixes:
|
||||||
- Command ``flavor set/unset`` now outputs nothing.
|
- Command ``flavor set/unset`` now outputs nothing.
|
||||||
[Bug `1546065 <https://bugs.launchpad.net/python-openstackclient/+bug/1546065>`_]
|
[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