mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
@@ -2,10 +2,10 @@
|
|||||||
# This file is a utility Ansible plugin that is not part of the AWX or Ansible
|
# This file is a utility Ansible plugin that is not part of the AWX or Ansible
|
||||||
# packages. It does not import any code from either package, nor does its
|
# packages. It does not import any code from either package, nor does its
|
||||||
# license apply to Ansible or AWX.
|
# license apply to Ansible or AWX.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
#
|
#
|
||||||
# Redistributions of source code must retain the above copyright notice, this
|
# Redistributions of source code must retain the above copyright notice, this
|
||||||
# list of conditions and the following disclaimer.
|
# list of conditions and the following disclaimer.
|
||||||
#
|
#
|
||||||
@@ -66,8 +66,12 @@ CENSOR_FIELD_WHITELIST=[
|
|||||||
'skip_reason',
|
'skip_reason',
|
||||||
]
|
]
|
||||||
|
|
||||||
def censor(obj):
|
def censor(obj, no_log=False):
|
||||||
if obj.get('_ansible_no_log', False):
|
if type(obj) is not dict:
|
||||||
|
if no_log:
|
||||||
|
return "the output has been hidden due to the fact that 'no_log: true' was specified for this result"
|
||||||
|
return obj
|
||||||
|
if obj.get('_ansible_no_log', no_log):
|
||||||
new_obj = {}
|
new_obj = {}
|
||||||
for k in CENSOR_FIELD_WHITELIST:
|
for k in CENSOR_FIELD_WHITELIST:
|
||||||
if k in obj:
|
if k in obj:
|
||||||
@@ -80,8 +84,12 @@ def censor(obj):
|
|||||||
new_obj['censored'] = "the output has been hidden due to the fact that 'no_log: true' was specified for this result"
|
new_obj['censored'] = "the output has been hidden due to the fact that 'no_log: true' was specified for this result"
|
||||||
obj = new_obj
|
obj = new_obj
|
||||||
if 'results' in obj:
|
if 'results' in obj:
|
||||||
for i in xrange(len(obj['results'])):
|
if type(obj['results']) is list:
|
||||||
obj['results'][i] = censor(obj['results'][i])
|
for i in xrange(len(obj['results'])):
|
||||||
|
obj['results'][i] = censor(obj['results'][i], obj.get('_ansible_no_log', no_log))
|
||||||
|
elif obj.get('_ansible_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
|
return obj
|
||||||
|
|
||||||
|
|
||||||
@@ -410,7 +418,7 @@ class JobCallbackModule(BaseCallbackModule):
|
|||||||
# this from a normal task
|
# this from a normal task
|
||||||
self._log_event('playbook_on_task_start', task=task,
|
self._log_event('playbook_on_task_start', task=task,
|
||||||
name=task.get_name())
|
name=task.get_name())
|
||||||
|
|
||||||
def playbook_on_vars_prompt(self, varname, private=True, prompt=None,
|
def playbook_on_vars_prompt(self, varname, private=True, prompt=None,
|
||||||
encrypt=None, confirm=False, salt_size=None,
|
encrypt=None, confirm=False, salt_size=None,
|
||||||
salt=None, default=None):
|
salt=None, default=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user