mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #40689 from jbadson/fix-syslog-returner
Fixes bug that prevents syslog returner from working under Python 2.6
This commit is contained in:
commit
bc70772f9d
1 changed files with 8 additions and 4 deletions
|
@ -192,10 +192,14 @@ def returner(ret):
|
|||
logoption = logoption | getattr(syslog, opt)
|
||||
|
||||
# Open syslog correctly based on options and tag
|
||||
if 'tag' in _options:
|
||||
syslog.openlog(ident=_options['tag'], logoption=logoption)
|
||||
else:
|
||||
syslog.openlog(logoption=logoption)
|
||||
try:
|
||||
if 'tag' in _options:
|
||||
syslog.openlog(ident=_options['tag'], logoption=logoption)
|
||||
else:
|
||||
syslog.openlog(logoption=logoption)
|
||||
except TypeError:
|
||||
# Python 2.6 syslog.openlog does not accept keyword args
|
||||
syslog.openlog(_options.get('tag', 'salt-minion'), logoption)
|
||||
|
||||
# Send log of given level and facility
|
||||
syslog.syslog(facility | level, '{0}'.format(json.dumps(ret)))
|
||||
|
|
Loading…
Add table
Reference in a new issue