From 5ef077e58ca5bbb208bf942facd6fdf53180abfa Mon Sep 17 00:00:00 2001 From: willthames Date: Thu, 27 Dec 2012 14:49:44 +1000 Subject: [PATCH] syslog.openlog does not cope with unicode first argument It seems that os.path.basename(__file__) can return a unicode string. In this case syslog.openlog fails. Forcing the result to a string causes the resulting error to go away. --- lib/ansible/module_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index 51fb1f7499a..d6ed081faed 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -549,7 +549,7 @@ class AnsibleModule(object): journal.sendv(*journal_args) else: msg = '' - syslog.openlog('ansible-%s' % os.path.basename(__file__), 0, syslog.LOG_USER) + syslog.openlog('ansible-%s' % str(os.path.basename(__file__)), 0, syslog.LOG_USER) for arg in log_args: msg = msg + arg + '=' + str(log_args[arg]) + ' ' if msg: