@@ -242,7 +242,7 @@ def take_action(self, parsed_args):
242242 return zip (* sorted (six .iteritems (flavor )))
243243
244244
245- class SetFlavor (command .ShowOne ):
245+ class SetFlavor (command .Command ):
246246 """Set flavor properties"""
247247
248248 def get_parser (self , prog_name ):
@@ -263,17 +263,11 @@ def get_parser(self, prog_name):
263263
264264 def take_action (self , parsed_args ):
265265 compute_client = self .app .client_manager .compute
266- resource_flavor = compute_client .flavors .find (name = parsed_args .flavor )
266+ flavor = compute_client .flavors .find (name = parsed_args .flavor )
267+ flavor .set_keys (parsed_args .property )
267268
268- resource_flavor .set_keys (parsed_args .property )
269269
270- flavor = resource_flavor ._info .copy ()
271- flavor ['properties' ] = utils .format_dict (resource_flavor .get_keys ())
272- flavor .pop ("links" , None )
273- return zip (* sorted (six .iteritems (flavor )))
274-
275-
276- class UnsetFlavor (command .ShowOne ):
270+ class UnsetFlavor (command .Command ):
277271 """Unset flavor properties"""
278272
279273 def get_parser (self , prog_name ):
@@ -295,11 +289,5 @@ def get_parser(self, prog_name):
295289
296290 def take_action (self , parsed_args ):
297291 compute_client = self .app .client_manager .compute
298- resource_flavor = compute_client .flavors .find (name = parsed_args .flavor )
299-
300- resource_flavor .unset_keys (parsed_args .property )
301-
302- flavor = resource_flavor ._info .copy ()
303- flavor ['properties' ] = utils .format_dict (resource_flavor .get_keys ())
304- flavor .pop ("links" , None )
305- return zip (* sorted (six .iteritems (flavor )))
292+ flavor = compute_client .flavors .find (name = parsed_args .flavor )
293+ flavor .unset_keys (parsed_args .property )
0 commit comments