Commit c5720092 by Brian Coca

made syslog import optional as intel's edison custom compiles python w/o it

parent 2963bba9
...@@ -54,7 +54,6 @@ import pipes ...@@ -54,7 +54,6 @@ import pipes
import shlex import shlex
import subprocess import subprocess
import sys import sys
import syslog
import types import types
import time import time
import select import select
...@@ -69,6 +68,12 @@ import errno ...@@ -69,6 +68,12 @@ import errno
from itertools import repeat from itertools import repeat
try: try:
import syslog
HAS_SYSLOG=True
except ImportError:
HAS_SYSLOG=False
try:
# Python 2 # Python 2
from itertools import imap from itertools import imap
except ImportError: except ImportError:
...@@ -1246,9 +1251,10 @@ class AnsibleModule(object): ...@@ -1246,9 +1251,10 @@ class AnsibleModule(object):
return params return params
def _log_to_syslog(self, msg): def _log_to_syslog(self, msg):
module = 'ansible-%s' % os.path.basename(__file__) if HAS_SYSLOG:
syslog.openlog(str(module), 0, syslog.LOG_USER) module = 'ansible-%s' % os.path.basename(__file__)
syslog.syslog(syslog.LOG_INFO, msg) syslog.openlog(str(module), 0, syslog.LOG_USER)
syslog.syslog(syslog.LOG_INFO, msg)
def debug(self, msg): def debug(self, msg):
if self._debug: if self._debug:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment