Skip to content

Commit

Permalink
Merge "Improve performance of safe_log()."
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Mar 26, 2012
2 parents ff150b3 + 2b3e368 commit 3433fd6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nova/rpc/common.py
Expand Up @@ -127,7 +127,12 @@ def consume_in_thread(self):

def _safe_log(log_func, msg, msg_data):
"""Sanitizes the msg_data field before logging."""
has_method = 'method' in msg_data
SANITIZE = {
'set_admin_password': ('new_pass',),
'run_instance': ('admin_password',),
}

has_method = 'method' in msg_data and msg_data['method'] in SANITIZE
has_context_token = '_context_auth_token' in msg_data
has_token = 'auth_token' in msg_data

Expand All @@ -137,10 +142,6 @@ def _safe_log(log_func, msg, msg_data):
msg_data = copy.deepcopy(msg_data)

if has_method:
SANITIZE = {
'set_admin_password': ('new_pass',),
'run_instance': ('admin_password',),
}
method = msg_data['method']
if method in SANITIZE:
args_to_sanitize = SANITIZE[method]
Expand Down

0 comments on commit 3433fd6

Please sign in to comment.