From 6193f2ba96632739913d4226c7ed8160f7010a82 Mon Sep 17 00:00:00 2001 From: Mike Perez Date: Wed, 31 Jul 2013 16:03:17 -0700 Subject: [PATCH] Remove locals() from cinder client code base Hacking file now disallows locals() usage. Change-Id: I5049c718c2706d606c12913ae0b33a0fb3263542 --- cinderclient/utils.py | 8 ++++++-- cinderclient/v1/shell.py | 2 +- cinderclient/v2/shell.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cinderclient/utils.py b/cinderclient/utils.py index 922f053e9..93be47708 100644 --- a/cinderclient/utils.py +++ b/cinderclient/utils.py @@ -88,8 +88,12 @@ def get_resource_manager_extra_kwargs(f, args, allow_conflicts=False): conflicting_keys = set(hook_kwargs.keys()) & set(extra_kwargs.keys()) if conflicting_keys and not allow_conflicts: - raise Exception("Hook '%(hook_name)s' is attempting to redefine" - " attributes '%(conflicting_keys)s'" % locals()) + msg = ("Hook '%(hook_name)s' is attempting to redefine attributes " + "'%(conflicting_keys)s'" % { + 'hook_name': hook_name, + 'conflicting_keys': conflicting_keys + }) + raise Exception(msg) extra_kwargs.update(hook_kwargs) diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index 82cb9f0af..a2211fd72 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -53,7 +53,7 @@ def _poll_for_status(poll_fn, obj_id, action, final_ok_states, print("\nFinished") break elif status == "error": - print("\nError %(action)s instance" % locals()) + print("\nError %(action)s instance" % {'action': action}) break else: print_progress(progress) diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index b023125e6..fe2099c7d 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -51,7 +51,7 @@ def _poll_for_status(poll_fn, obj_id, action, final_ok_states, print("\nFinished") break elif status == "error": - print("\nError %(action)s instance" % locals()) + print("\nError %(action)s instance" % {'action': action}) break else: print_progress(progress)