use utils.key_value_pairs_to_dict()

utils.key_value_pairs_to_dict() was recently added to the
code base; utils.args_array_to_dict() calls
utils.key_value_pairs_to_dict().

This replaces calls to utils.args_array_to_dict() with calls
to utils.key_value_pairs_to_dict() when the latter is really
the goal. Doing this avoids creating a temporary dictionary.

Change-Id: I6295c9442e4ce4b4ad0ac2930eb2797f30683793
This commit is contained in:
Ruby Loo
2016-09-01 13:15:49 -04:00
parent 464044f87d
commit a9fd604aaa
2 changed files with 2 additions and 13 deletions

View File

@@ -89,11 +89,7 @@ class PassthruCallBaremetalDriver(command.ShowOne):
self.log.debug("take_action(%s)", parsed_args)
baremetal_client = self.app.client_manager.baremetal
arguments = utils.args_array_to_dict(
{'args': parsed_args.arg}, 'args')['args']
if not arguments:
arguments = {}
arguments = utils.key_value_pairs_to_dict(parsed_args.arg)
response = (baremetal_client.driver.
vendor_passthru(parsed_args.driver,
parsed_args.method,

View File

@@ -662,14 +662,7 @@ class PassthruCallBaremetalNode(command.Command):
baremetal_client = self.app.client_manager.baremetal
arguments = utils.args_array_to_dict(
{'args': parsed_args.arg}, 'args')['args']
# If there were no arguments for the method, arguments will still
# be an empty list. So make it an empty dict.
if not arguments:
arguments = {}
arguments = utils.key_value_pairs_to_dict(parsed_args.arg)
resp = baremetal_client.node.vendor_passthru(
parsed_args.node,
parsed_args.method,