mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 06:56:00 -03:30
@@ -37,6 +37,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
import urlparse
|
import urlparse
|
||||||
|
import re
|
||||||
|
|
||||||
# Requests
|
# Requests
|
||||||
import requests
|
import requests
|
||||||
@@ -126,6 +127,31 @@ class BaseCallbackModule(object):
|
|||||||
self._init_connection()
|
self._init_connection()
|
||||||
if self.context is None:
|
if self.context is None:
|
||||||
self._start_connection()
|
self._start_connection()
|
||||||
|
if 'res' in event_data \
|
||||||
|
and event_data['res'].get('_ansible_no_log', False):
|
||||||
|
res = event_data['res']
|
||||||
|
if 'stdout' in res and res['stdout']:
|
||||||
|
res['stdout'] = '<censored>'
|
||||||
|
if 'stdout_lines' in res and res['stdout_lines']:
|
||||||
|
res['stdout_lines'] = ['<censored>']
|
||||||
|
if 'stderr' in res and res['stderr']:
|
||||||
|
res['stderr'] = '<censored>'
|
||||||
|
if 'stderr_lines' in res and res['stderr_lines']:
|
||||||
|
res['stderr_lines'] = ['<censored>']
|
||||||
|
if res.get('cmd', None) and re.search(r'\s', res['cmd']):
|
||||||
|
res['cmd'] = re.sub(r'^(([^\s\\]|\\\s)+).*$',
|
||||||
|
r'\1 <censored>',
|
||||||
|
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 <censored>',
|
||||||
|
res['invocation']['module_args']['_raw_params'])
|
||||||
|
msg['event_data']['res'] = res
|
||||||
|
|
||||||
self.socket.send_json(msg)
|
self.socket.send_json(msg)
|
||||||
self.socket.recv()
|
self.socket.recv()
|
||||||
|
|||||||
Reference in New Issue
Block a user