diff --git a/doc/source/backwards-incompatible.rst b/doc/source/backwards-incompatible.rst index 5152641991..752f52e3e2 100644 --- a/doc/source/backwards-incompatible.rst +++ b/doc/source/backwards-incompatible.rst @@ -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 ============== diff --git a/functional/tests/network/v2/test_security_group.py b/functional/tests/network/v2/test_security_group.py index 2089b1d5dd..4fc4d12df3 100644 --- a/functional/tests/network/v2/test_security_group.py +++ b/functional/tests/network/v2/test_security_group.py @@ -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) diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py index 6f2e1a52ca..2a7b40f4cd 100644 --- a/openstackclient/compute/v2/security_group.py +++ b/openstackclient/compute/v2/security_group.py @@ -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): diff --git a/releasenotes/notes/bug-1546065-41d09ffbd8606513.yaml b/releasenotes/notes/bug-1546065-41d09ffbd8606513.yaml index 1d7e126686..f0c3463828 100644 --- a/releasenotes/notes/bug-1546065-41d09ffbd8606513.yaml +++ b/releasenotes/notes/bug-1546065-41d09ffbd8606513.yaml @@ -2,3 +2,5 @@ fixes: - Command ``flavor set/unset`` now outputs nothing. [Bug `1546065 `_] + - Command ``security group set`` now outputs nothing. + [Bug `1546065 `_]