mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
made syslog import optional as intel's edison custom compiles python w/o it
This commit is contained in:
parent
2963bba901
commit
c57200925f
1 changed files with 10 additions and 4 deletions
|
@ -54,7 +54,6 @@ import pipes
|
|||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import syslog
|
||||
import types
|
||||
import time
|
||||
import select
|
||||
|
@ -68,6 +67,12 @@ import platform
|
|||
import errno
|
||||
from itertools import repeat
|
||||
|
||||
try:
|
||||
import syslog
|
||||
HAS_SYSLOG=True
|
||||
except ImportError:
|
||||
HAS_SYSLOG=False
|
||||
|
||||
try:
|
||||
# Python 2
|
||||
from itertools import imap
|
||||
|
@ -1246,9 +1251,10 @@ class AnsibleModule(object):
|
|||
return params
|
||||
|
||||
def _log_to_syslog(self, msg):
|
||||
module = 'ansible-%s' % os.path.basename(__file__)
|
||||
syslog.openlog(str(module), 0, syslog.LOG_USER)
|
||||
syslog.syslog(syslog.LOG_INFO, msg)
|
||||
if HAS_SYSLOG:
|
||||
module = 'ansible-%s' % os.path.basename(__file__)
|
||||
syslog.openlog(str(module), 0, syslog.LOG_USER)
|
||||
syslog.syslog(syslog.LOG_INFO, msg)
|
||||
|
||||
def debug(self, msg):
|
||||
if self._debug:
|
||||
|
|
Loading…
Reference in a new issue