mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Fixes bug that prevents syslog returner from working under Python 2.6
Fixes #40688
This commit is contained in:
parent
3cd9a50b22
commit
e5a3a7d217
@ -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…
Reference in New Issue
Block a user