mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Sanitize possible password argument when logging invocation; taken from user module
This commit is contained in:
parent
baf07659f7
commit
8195375412
1 changed files with 4 additions and 1 deletions
|
@ -33,6 +33,7 @@ try:
|
|||
except ImportError:
|
||||
import simplejson as json
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -118,7 +119,9 @@ class AnsibleModule(object):
|
|||
def _log_invocation(self):
|
||||
''' log that ansible ran the module '''
|
||||
syslog.openlog('ansible-%s' % os.path.basename(__file__))
|
||||
syslog.syslog(syslog.LOG_NOTICE, 'Invoked with %s' % self.args)
|
||||
# Sanitize possible password argument when logging
|
||||
log_args = re.sub(r'password=.+ (.*)', r"password=NOT_LOGGING_PASSWORD \1", self.args)
|
||||
syslog.syslog(syslog.LOG_NOTICE, 'Invoked with %s' % log_args)
|
||||
|
||||
def exit_json(self, **kwargs):
|
||||
''' return from the module, without error '''
|
||||
|
|
Loading…
Reference in a new issue