diff options
author | Max Illfelder <illfelder@users.noreply.github.com> | 2019-03-25 10:25:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 10:25:32 -0700 |
commit | 409408af3a0a222286c06f3f026b81dac459593c (patch) | |
tree | d4efc1a529382146e4a9297ab5a6d6b596a2a38d /packages | |
parent | f496827ce3907b167f4b85d921efc6b497922da8 (diff) | |
download | google-compute-image-packages-409408af3a0a222286c06f3f026b81dac459593c.tar.gz |
Add support for FreeBSD syslog socket location. (#751)
Diffstat (limited to 'packages')
3 files changed, 20 insertions, 18 deletions
diff --git a/packages/python-google-compute-engine/google_compute_engine/constants.py b/packages/python-google-compute-engine/google_compute_engine/constants.py index d908275..cfe87c4 100644 --- a/packages/python-google-compute-engine/google_compute_engine/constants.py +++ b/packages/python-google-compute-engine/google_compute_engine/constants.py @@ -21,20 +21,23 @@ OSLOGIN_CONTROL_SCRIPT = 'google_oslogin_control' OSLOGIN_NSS_CACHE_SCRIPT = 'google_oslogin_nss_cache' if platform.system() == 'FreeBSD': - LOCALBASE = '/usr/local' - BOTOCONFDIR = '/usr/local' - SYSCONFDIR = '/usr/local/etc' - LOCALSTATEDIR = '/var/spool' - OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache' + BOTOCONFDIR = '/usr/local' + LOCALBASE = '/usr/local' + LOCALSTATEDIR = '/var/spool' + OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache' + SYSCONFDIR = '/usr/local/etc' + SYSLOG_SOCKET = '/var/run/log' elif platform.system() == 'OpenBSD': - LOCALBASE = '/usr/local' - BOTOCONFDIR = '' - SYSCONFDIR = '/usr/local/etc' - LOCALSTATEDIR = '/var/spool' - OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache' + BOTOCONFDIR = '' + LOCALBASE = '/usr/local' + LOCALSTATEDIR = '/var/spool' + OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache' + SYSCONFDIR = '/usr/local/etc' + SYSLOG_SOCKET = '/dev/log' else: - LOCALBASE = '' - BOTOCONFDIR = '' - SYSCONFDIR = '/etc/default' - LOCALSTATEDIR = '/var' - OSLOGIN_NSS_CACHE = '/etc/oslogin_passwd.cache' + BOTOCONFDIR = '' + LOCALBASE = '' + LOCALSTATEDIR = '/var' + OSLOGIN_NSS_CACHE = '/etc/oslogin_passwd.cache' + SYSCONFDIR = '/etc/default' + SYSLOG_SOCKET = '/dev/log' diff --git a/packages/python-google-compute-engine/google_compute_engine/logger.py b/packages/python-google-compute-engine/google_compute_engine/logger.py index a075eae..5599570 100644 --- a/packages/python-google-compute-engine/google_compute_engine/logger.py +++ b/packages/python-google-compute-engine/google_compute_engine/logger.py @@ -15,6 +15,7 @@ """A library for logging text to SysLog and the serial console.""" +from google_compute_engine import constants from google_compute_engine.compat import logging @@ -46,7 +47,7 @@ def Logger(name, debug=False, facility=None): if facility: # Create a handler for sending logs to SysLog. syslog_handler = logging.handlers.SysLogHandler( - address='/dev/log', facility=facility) + address=constants.SYSLOG_SOCKET, facility=facility) syslog_handler.setLevel(logging.INFO) syslog_handler.setFormatter(formatter) logger.addHandler(syslog_handler) diff --git a/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py b/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py index 3523f72..e5e5ec1 100644 --- a/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py +++ b/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py @@ -19,8 +19,6 @@ import os import stat import subprocess -from google_compute_engine import constants - class ScriptExecutor(object): """A class for executing user provided metadata scripts.""" |