mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
By popular request, make the no_log attribute also censor tasks from callbacks.
This commit is contained in:
@@ -759,3 +759,22 @@ class TestUtils(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
def test_censor_unlogged_data(self):
|
||||
''' used by the no_log attribute '''
|
||||
input = dict(
|
||||
password='sekrit',
|
||||
rc=12,
|
||||
failed=True,
|
||||
changed=False,
|
||||
skipped=True,
|
||||
msg='moo',
|
||||
)
|
||||
data = ansible.utils.censor_unlogged_data(input)
|
||||
assert 'password' not in data
|
||||
assert 'rc' in data
|
||||
assert 'failed' in data
|
||||
assert 'changed' in data
|
||||
assert 'skipped' in data
|
||||
assert 'msg' not in data
|
||||
assert data['censored'] == 'results hidden due to no_log parameter'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user