mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
By popular request, make the no_log attribute also censor tasks from callbacks.
This commit is contained in:
@@ -1436,3 +1436,19 @@ def update_hash(hash, key, new_value):
|
||||
value = hash.get(key, {})
|
||||
value.update(new_value)
|
||||
hash[key] = value
|
||||
|
||||
def censor_unlogged_data(data):
|
||||
'''
|
||||
used when the no_log: True attribute is passed to a task to keep data from a callback.
|
||||
NOT intended to prevent variable registration, but only things from showing up on
|
||||
screen
|
||||
'''
|
||||
new_data = {}
|
||||
for (x,y) in data.iteritems():
|
||||
if x in [ 'skipped', 'changed', 'failed', 'rc' ]:
|
||||
new_data[x] = y
|
||||
new_data['censored'] = 'results hidden due to no_log parameter'
|
||||
return new_data
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user