1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Proposed fix for ansible/ansible-modules-extras#1348 due to datetime.datetime type not being matched

This commit is contained in:
Etherdaemon 2015-12-27 21:31:59 +10:00
parent d70a97b562
commit 0b92abaf67

View file

@ -65,6 +65,7 @@ import grp
import pwd import pwd
import platform import platform
import errno import errno
import datetime
from itertools import repeat, chain from itertools import repeat, chain
try: try:
@ -423,10 +424,13 @@ def remove_values(value, no_log_strings):
for omit_me in no_log_strings: for omit_me in no_log_strings:
if omit_me in stringy_value: if omit_me in stringy_value:
return 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' return 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER'
elif isinstance(value, datetime.datetime):
value = value.isoformat()
else: else:
raise TypeError('Value of unknown type: %s, %s' % (type(value), value)) raise TypeError('Value of unknown type: %s, %s' % (type(value), value))
return value return value
def heuristic_log_sanitize(data, no_log_values=None): def heuristic_log_sanitize(data, no_log_values=None):
''' Remove strings that look like passwords from log messages ''' ''' Remove strings that look like passwords from log messages '''
# Currently filters: # Currently filters: