mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 12:51:25 -07:00
Port forward lmacken's fix for 9886 to v2
This commit is contained in:
parent
82abe63eb2
commit
2a04663255
1 changed files with 3 additions and 4 deletions
|
@ -1094,12 +1094,11 @@ class AnsibleModule(object):
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
|
|
||||||
if (has_journal):
|
if (has_journal):
|
||||||
journal_args = ["MESSAGE=%s %s" % (module, msg)]
|
journal_args = [("MODULE", os.path.basename(__file__))]
|
||||||
journal_args.append("MODULE=%s" % os.path.basename(__file__))
|
|
||||||
for arg in log_args:
|
for arg in log_args:
|
||||||
journal_args.append(arg.upper() + "=" + str(log_args[arg]))
|
journal_args.append((arg.upper(), str(log_args[arg])))
|
||||||
try:
|
try:
|
||||||
journal.sendv(*journal_args)
|
journal.send("%s %s" % (module, msg), **dict(journal_args))
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
# fall back to syslog since logging to journal failed
|
# fall back to syslog since logging to journal failed
|
||||||
syslog.openlog(str(module), 0, syslog.LOG_USER)
|
syslog.openlog(str(module), 0, syslog.LOG_USER)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue