Fix unicode decode error in syslog for modules

Fixes #6056
This commit is contained in:
James Cammarata 2014-02-19 09:41:35 -05:00
parent 181526847e
commit b6222abee6

View file

@ -814,10 +814,10 @@ class AnsibleModule(object):
except IOError, e:
# fall back to syslog since logging to journal failed
syslog.openlog(str(module), 0, syslog.LOG_USER)
syslog.syslog(syslog.LOG_NOTICE, msg.decode('utf8').encode('utf8'))
syslog.syslog(syslog.LOG_NOTICE, unicode(msg).encode('utf8'))
else:
syslog.openlog(str(module), 0, syslog.LOG_USER)
syslog.syslog(syslog.LOG_NOTICE, msg.decode('utf8').encode('utf8'))
syslog.syslog(syslog.LOG_NOTICE, unicode(msg).encode('utf8'))
def get_bin_path(self, arg, required=False, opt_dirs=[]):
'''