diff options
author | Etherdaemon <kaz.cheng@gmail.com> | 2015-12-27 21:31:59 +1000 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2016-02-09 17:12:36 -0500 |
commit | fa88d0770cc695400c179bfdb8a9d69d57e355b5 (patch) | |
tree | 1fe2285bab409f98edc9a06bfc26976416bdb2dc | |
parent | 24cae22e0bb070a9e96b6185f86e4adf65d13bfd (diff) | |
download | ansible-fa88d0770cc695400c179bfdb8a9d69d57e355b5.tar.gz |
Proposed fix for ansible/ansible-modules-extras#1348 due to datetime.datetime type not being matched
-rw-r--r-- | lib/ansible/module_utils/basic.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 0ac54cb580..c02f25a62a 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -65,6 +65,7 @@ import grp import pwd import platform import errno +import datetime from itertools import repeat, chain try: @@ -423,10 +424,13 @@ def remove_values(value, no_log_strings): for omit_me in no_log_strings: if omit_me in stringy_value: return 'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER' + elif isinstance(value, datetime.datetime): + value = value.isoformat() else: raise TypeError('Value of unknown type: %s, %s' % (type(value), value)) return value + def heuristic_log_sanitize(data, no_log_values=None): ''' Remove strings that look like passwords from log messages ''' # Currently filters: |