mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 04:17:36 -02:30
Include @anoek's changes from #1029.
This commit is contained in:
@@ -90,10 +90,12 @@ CENSOR_FIELD_WHITELIST=[
|
|||||||
'skip_reason',
|
'skip_reason',
|
||||||
]
|
]
|
||||||
|
|
||||||
def censor(obj):
|
def censor(obj, no_log=False):
|
||||||
if not isinstance(obj, dict):
|
if not isinstance(obj, 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
|
return obj
|
||||||
if obj.get('_ansible_no_log', False):
|
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:
|
||||||
@@ -106,8 +108,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 isinstance(obj['results'], 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
|
||||||
|
|
||||||
class TokenAuth(requests.auth.AuthBase):
|
class TokenAuth(requests.auth.AuthBase):
|
||||||
|
|||||||
Reference in New Issue
Block a user