mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Merge branch 'bugfix/aa-always-logfile-fallback' into 'master'
Fix error 'KeyError: 'logfiles'' when no logprof.conf exists See merge request apparmor/apparmor!365 Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master
This commit is contained in:
commit
cece787182
1 changed files with 7 additions and 3 deletions
|
@ -1761,14 +1761,18 @@ def set_logfile(filename):
|
|||
|
||||
if filename:
|
||||
logfile = filename
|
||||
else:
|
||||
elif 'logfiles' in cfg['settings']:
|
||||
# This line can only run if the 'logfile' exists in settings, otherwise
|
||||
# it will yield a Python KeyError
|
||||
logfile = conf.find_first_file(cfg['settings']['logfiles']) or '/var/log/syslog'
|
||||
else:
|
||||
logfile = '/var/log/syslog'
|
||||
|
||||
if not os.path.exists(logfile):
|
||||
if filename:
|
||||
raise AppArmorException(_('The logfile %s does not exist. Please check the path') % logfile)
|
||||
raise AppArmorException(_('The logfile %s does not exist. Please check the path.') % logfile)
|
||||
else:
|
||||
raise AppArmorException('Can\'t find system log "%s".' % (logfile))
|
||||
raise AppArmorException('Can\'t find system log "%s". Please check permissions.' % (logfile))
|
||||
elif os.path.isdir(logfile):
|
||||
raise AppArmorException(_('%s is a directory. Please specify a file as logfile') % logfile)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue