Skip to content

Commit

Permalink
Omit SysLogHandler when /dev/log does not exist
Browse files Browse the repository at this point in the history
slaptests use SysLogHandler() to write logs to syslog. Don't create a
SysLogHandler when /dev/log does not exist. This fixes a bug when
building and testing python-ldap in containers or restricted build
environments.

https://github.com/python-ldap/python-ldap/pull/28
See: https://github.com/python-ldap/python-ldap/issues/43
Signed-off-by: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
Christian Heimes authored and Petr Viktorin committed Nov 28, 2017
1 parent 4b97671 commit 680c342
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/slapdtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def combined_logger(
pass
# for writing to syslog
new_logger = logging.getLogger(log_name)
if sys_log_format:
if sys_log_format and os.path.exists('/dev/log'):
my_syslog_formatter = logging.Formatter(
fmt=' '.join((log_name, sys_log_format)))
my_syslog_handler = logging.handlers.SysLogHandler(
Expand Down

0 comments on commit 680c342

Please sign in to comment.