From 4524b3605fa4260a2f916421eebfc7a99b320e4b Mon Sep 17 00:00:00 2001 From: Huanxuan Ao Date: Thu, 28 Apr 2016 11:09:49 +0800 Subject: Fix error in flavor set/unset command In the "flavor set/unset" command,the "flavor" parameter can be a name but can not be a id of a flavor. I think we should find a flavor by using "utils.find_resource()" in these commands. Change-Id: I5836788f7ed18813f1ebde31bb808b7c3f932b80 Closes-Bug: #1575624 --- openstackclient/compute/v2/flavor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'openstackclient/compute') diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py index 29e0e9d4..04674614 100644 --- a/openstackclient/compute/v2/flavor.py +++ b/openstackclient/compute/v2/flavor.py @@ -239,7 +239,8 @@ class SetFlavor(command.Command): def take_action(self, parsed_args): compute_client = self.app.client_manager.compute - flavor = compute_client.flavors.find(name=parsed_args.flavor) + flavor = utils.find_resource(compute_client.flavors, + parsed_args.flavor) flavor.set_keys(parsed_args.property) @@ -289,5 +290,6 @@ class UnsetFlavor(command.Command): def take_action(self, parsed_args): compute_client = self.app.client_manager.compute - flavor = compute_client.flavors.find(name=parsed_args.flavor) + flavor = utils.find_resource(compute_client.flavors, + parsed_args.flavor) flavor.unset_keys(parsed_args.property) -- cgit v1.2.1