From 601bd0da0541cc4e097b6c7d76e013d67f194572 Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Mon, 25 Apr 2016 15:52:38 -0400 Subject: [PATCH] Fixed up 2.4.5 -> 3.0 no_log merge Addresses #1295 --- awx/plugins/callback/job_event_callback.py | 30 +++------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/awx/plugins/callback/job_event_callback.py b/awx/plugins/callback/job_event_callback.py index 8aa6dfc9e5..a9c5b712ed 100644 --- a/awx/plugins/callback/job_event_callback.py +++ b/awx/plugins/callback/job_event_callback.py @@ -70,7 +70,7 @@ import psutil # pass # statsd = NoStatsClient() -CENSOR_FIELD_WHITELIST=[ +CENSOR_FIELD_WHITELIST = [ 'msg', 'failed', 'changed', @@ -80,7 +80,6 @@ CENSOR_FIELD_WHITELIST=[ 'delta', 'cmd', '_ansible_no_log', - 'cmd', 'rc', 'failed_when_result', 'skipped', @@ -114,6 +113,7 @@ def censor(obj, no_log=False): obj['results'] = "the output has been hidden due to the fact that 'no_log: true' was specified for this result" return obj + class TokenAuth(requests.auth.AuthBase): def __init__(self, token): @@ -194,31 +194,7 @@ class BaseCallbackModule(object): self._init_connection() if self.context is None: self._start_connection() - if 'res' in event_data and hasattr(event_data['res'], 'get') \ - and event_data['res'].get('_ansible_no_log', False): - res = event_data['res'] - if 'stdout' in res and res['stdout']: - res['stdout'] = '' - if 'stdout_lines' in res and res['stdout_lines']: - res['stdout_lines'] = [''] - if 'stderr' in res and res['stderr']: - res['stderr'] = '' - if 'stderr_lines' in res and res['stderr_lines']: - res['stderr_lines'] = [''] - if res.get('cmd', None) and re.search(r'\s', res['cmd']): - res['cmd'] = re.sub(r'^(([^\s\\]|\\\s)+).*$', - r'\1 ', - res['cmd']) - if 'invocation' in res \ - and 'module_args' in res['invocation'] \ - and '_raw_params' in res['invocation']['module_args'] \ - and re.search(r'\s', - res['invocation']['module_args']['_raw_params']): - res['invocation']['module_args']['_raw_params'] = \ - re.sub(r'^(([^\s\\]|\\\s)+).*$', - r'\1 ', - res['invocation']['module_args']['_raw_params']) - msg['event_data']['res'] = res + self.socket.send_json(msg) self.socket.recv() return