summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-02-17 15:20:36 +0800
committerTang Chen <chen.tang@easystack.cn>2016-02-27 03:47:57 +0800
commit859bfaf8757086c8607c1520c8018ab20e91a3ac (patch)
tree653ff6662c65366c92a8b41b16201d7bc0d49c1e
parentf37eda3a27dc88d3186d21eca328cca086ee3647 (diff)
downloadpython-openstackclient-859bfaf8757086c8607c1520c8018ab20e91a3ac.tar.gz
Make SetSecurityGroup inherit from cliff.Command
set/unset comamnd classes should inherit from cliff.Command class. Change-Id: Ie28711ac8823dc9eb13cf83877864ca436b928bc Partial-Bug: 1546065
-rw-r--r--doc/source/backwards-incompatible.rst12
-rw-r--r--functional/tests/network/v2/test_security_group.py17
-rw-r--r--openstackclient/compute/v2/security_group.py13
-rw-r--r--releasenotes/notes/bug-1546065-41d09ffbd8606513.yaml2
4 files changed, 27 insertions, 17 deletions
diff --git a/doc/source/backwards-incompatible.rst b/doc/source/backwards-incompatible.rst
index 51526419..752f52e3 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 2089b1d5..4fc4d12d 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 6f2e1a52..2a7b40f4 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 1d7e1266..f0c34638 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 <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>`_]