summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/compute/v2/flavor.py24
-rw-r--r--openstackclient/tests/compute/v2/test_flavor.py14
2 files changed, 10 insertions, 28 deletions
diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py
index 0308d940..e106bd65 100644
--- a/openstackclient/compute/v2/flavor.py
+++ b/openstackclient/compute/v2/flavor.py
@@ -242,7 +242,7 @@ class ShowFlavor(command.ShowOne):
return zip(*sorted(six.iteritems(flavor)))
-class SetFlavor(command.ShowOne):
+class SetFlavor(command.Command):
"""Set flavor properties"""
def get_parser(self, prog_name):
@@ -263,17 +263,11 @@ class SetFlavor(command.ShowOne):
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
- resource_flavor = compute_client.flavors.find(name=parsed_args.flavor)
+ flavor = compute_client.flavors.find(name=parsed_args.flavor)
+ flavor.set_keys(parsed_args.property)
- resource_flavor.set_keys(parsed_args.property)
- flavor = resource_flavor._info.copy()
- flavor['properties'] = utils.format_dict(resource_flavor.get_keys())
- flavor.pop("links", None)
- return zip(*sorted(six.iteritems(flavor)))
-
-
-class UnsetFlavor(command.ShowOne):
+class UnsetFlavor(command.Command):
"""Unset flavor properties"""
def get_parser(self, prog_name):
@@ -295,11 +289,5 @@ class UnsetFlavor(command.ShowOne):
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
- resource_flavor = compute_client.flavors.find(name=parsed_args.flavor)
-
- resource_flavor.unset_keys(parsed_args.property)
-
- flavor = resource_flavor._info.copy()
- flavor['properties'] = utils.format_dict(resource_flavor.get_keys())
- flavor.pop("links", None)
- return zip(*sorted(six.iteritems(flavor)))
+ flavor = compute_client.flavors.find(name=parsed_args.flavor)
+ flavor.unset_keys(parsed_args.property)
diff --git a/openstackclient/tests/compute/v2/test_flavor.py b/openstackclient/tests/compute/v2/test_flavor.py
index 5000e6a0..03ca8807 100644
--- a/openstackclient/tests/compute/v2/test_flavor.py
+++ b/openstackclient/tests/compute/v2/test_flavor.py
@@ -285,15 +285,12 @@ class TestFlavorSet(TestFlavor):
('property', {'FOO': '"B A R"'}),
('flavor', 'baremetal')
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- columns, data = self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
self.flavors_mock.find.assert_called_with(name='baremetal')
-
- self.assertEqual('properties', columns[6])
- self.assertIn('FOO=\'"B A R"\'', data[6])
+ self.assertIsNone(result)
class TestFlavorShow(TestFlavor):
@@ -382,12 +379,9 @@ class TestFlavorUnset(TestFlavor):
('property', ['property']),
('flavor', 'baremetal'),
]
-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- columns, data = self.cmd.take_action(parsed_args)
+ result = self.cmd.take_action(parsed_args)
self.flavors_mock.find.assert_called_with(name='baremetal')
-
- self.assertEqual('properties', columns[6])
- self.assertNotIn('property', data[6])
+ self.assertIsNone(result)