avoid showing invokation when no_log is set or verbosity is low

pull/12892/head
Brian Coca 9 years ago
parent 63ea614b4c
commit 275764d4a5

@ -50,7 +50,8 @@ class CallbackBase:
def _dump_results(self, result, indent=None, sort_keys=True): def _dump_results(self, result, indent=None, sort_keys=True):
if result.get('_ansible_no_log', False): no_log = result.get('_ansible_no_log', False):
if no_log:
return json.dumps(dict(censored="the output has been hidden due to the fact that 'no_log: true' was specified for this result")) return json.dumps(dict(censored="the output has been hidden due to the fact that 'no_log: true' was specified for this result"))
if not indent and '_ansible_verbose_always' in result and result['_ansible_verbose_always']: if not indent and '_ansible_verbose_always' in result and result['_ansible_verbose_always']:
@ -61,6 +62,10 @@ class CallbackBase:
if isinstance(k, string_types) and k.startswith('_ansible_'): if isinstance(k, string_types) and k.startswith('_ansible_'):
del result[k] del result[k]
# remove invocation info unless its very very verbose
if 'invocation' in result and (self._display.verbosity < 3 or no_log):
del result['invocation']
return json.dumps(result, indent=indent, ensure_ascii=False, sort_keys=sort_keys) return json.dumps(result, indent=indent, ensure_ascii=False, sort_keys=sort_keys)
def _handle_warnings(self, res): def _handle_warnings(self, res):

Loading…
Cancel
Save