|
|
|
@ -991,10 +991,12 @@ class AnsibleModule(object):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
found = False
|
|
|
|
found = False
|
|
|
|
for filter in filter_re:
|
|
|
|
for filter in filter_re:
|
|
|
|
if isinstance(self.params[param], unicode):
|
|
|
|
param_val = self.params[param]
|
|
|
|
m = filter.match(self.params[param])
|
|
|
|
if not isinstance(param_val, basestring):
|
|
|
|
else:
|
|
|
|
param_val = str(param_val)
|
|
|
|
m = filter.match(str(self.params[param]))
|
|
|
|
elif isinstance(param_val, unicode):
|
|
|
|
|
|
|
|
param_val = param_val.encode('utf-8')
|
|
|
|
|
|
|
|
m = filter.match(param_val)
|
|
|
|
if m:
|
|
|
|
if m:
|
|
|
|
d = m.groupdict()
|
|
|
|
d = m.groupdict()
|
|
|
|
log_args[param] = d['before'] + "********" + d['after']
|
|
|
|
log_args[param] = d['before'] + "********" + d['after']
|
|
|
|
@ -1004,22 +1006,27 @@ class AnsibleModule(object):
|
|
|
|
log_args[param] = self.params[param]
|
|
|
|
log_args[param] = self.params[param]
|
|
|
|
|
|
|
|
|
|
|
|
module = 'ansible-%s' % os.path.basename(__file__)
|
|
|
|
module = 'ansible-%s' % os.path.basename(__file__)
|
|
|
|
msg = ''
|
|
|
|
msg = []
|
|
|
|
for arg in log_args:
|
|
|
|
for arg in log_args:
|
|
|
|
if isinstance(log_args[arg], basestring):
|
|
|
|
arg_val = log_args[arg]
|
|
|
|
msg = msg + arg + '=' + log_args[arg].decode('utf-8') + ' '
|
|
|
|
if not isinstance(arg_val, basestring):
|
|
|
|
else:
|
|
|
|
arg_val = str(arg_val)
|
|
|
|
msg = msg + arg + '=' + str(log_args[arg]) + ' '
|
|
|
|
elif isinstance(arg_val, unicode):
|
|
|
|
|
|
|
|
arg_val = arg_val.encode('utf-8')
|
|
|
|
|
|
|
|
msg.append('%s=%s ' % (arg, arg_val))
|
|
|
|
if msg:
|
|
|
|
if msg:
|
|
|
|
msg = 'Invoked with %s' % msg
|
|
|
|
msg = 'Invoked with %s' % ''.join(msg)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
msg = 'Invoked'
|
|
|
|
msg = 'Invoked'
|
|
|
|
|
|
|
|
|
|
|
|
# 6655 - allow for accented characters
|
|
|
|
# 6655 - allow for accented characters
|
|
|
|
try:
|
|
|
|
if isinstance(msg, unicode):
|
|
|
|
msg = msg.encode('utf8')
|
|
|
|
# If we've done everything right up above msg should be type
|
|
|
|
except UnicodeDecodeError, e:
|
|
|
|
# str, not type unicode here. This is partial protection in case
|
|
|
|
pass
|
|
|
|
# we've done something wrong. But if we arrive here we can
|
|
|
|
|
|
|
|
# potentially get tracebacks in code up above (when mixing unicode
|
|
|
|
|
|
|
|
# and str together)
|
|
|
|
|
|
|
|
msg = msg.encode('utf-8')
|
|
|
|
|
|
|
|
|
|
|
|
if (has_journal):
|
|
|
|
if (has_journal):
|
|
|
|
journal_args = ["MESSAGE=%s %s" % (module, msg)]
|
|
|
|
journal_args = ["MESSAGE=%s %s" % (module, msg)]
|
|
|
|
|