From 8c04ef7d81f33900fda1ad3c4efa710827e22064 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Sun, 25 Oct 2020 13:49:25 -0600 Subject: [PATCH] Do not try to access log file if we are not running as root --- cobbler/clogger.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cobbler/clogger.py b/cobbler/clogger.py index 191455113..635865dc1 100644 --- a/cobbler/clogger.py +++ b/cobbler/clogger.py @@ -30,14 +30,8 @@ # Cobbler. # This is necessary to prevent apache to try to access the file -LOG_FILE = "/var/log/cobbler/cobbler.log" -try: - if not os.path.isfile(LOG_FILE): - open(LOG_FILE, 'a').close() - if os.access(LOG_FILE, os.W_OK): - logging.config.fileConfig('/etc/cobbler/logging_config.conf') -except Exception: - pass +if os.geteuid() == 0: + logging.config.fileConfig('/etc/cobbler/logging_config.conf') class Logger(object):