Fix for tasks breaking when using 'yum' with ansible 1.9.4

Fixes #1019
This commit is contained in:
Akita Noek
2016-02-24 11:35:24 -05:00
parent 7eb74cd011
commit df3715a36f

View File

@@ -66,8 +66,12 @@ CENSOR_FIELD_WHITELIST=[
'skip_reason',
]
def censor(obj):
if obj.get('_ansible_no_log', False):
def censor(obj, 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 = {}
for k in CENSOR_FIELD_WHITELIST:
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"
obj = new_obj
if 'results' in obj:
for i in xrange(len(obj['results'])):
obj['results'][i] = censor(obj['results'][i])
if type(obj['results']) is list:
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