Commit 68c30548 by James Cammarata

Properly catch and decode unicode strings in module _log_invocation()

Fixes #7084
parent 4f673b94
......@@ -828,8 +828,8 @@ class AnsibleModule(object):
module = 'ansible-%s' % os.path.basename(__file__)
msg = ''
for arg in log_args:
if isinstance(log_args[arg], unicode):
msg = msg + arg + '=' + log_args[arg] + ' '
if isinstance(log_args[arg], basestring):
msg = msg + arg + '=' + log_args[arg].decode('utf-8') + ' '
else:
msg = msg + arg + '=' + str(log_args[arg]) + ' '
if msg:
......@@ -839,7 +839,7 @@ class AnsibleModule(object):
# 6655 - allow for accented characters
try:
msg = unicode(msg).encode('utf8')
msg = msg.encode('utf8')
except UnicodeDecodeError, e:
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment