mirror of https://github.com/fail2ban/fail2ban
BF: Skip error in jail reader when no log files and with systemd backend
Updated to avoid logpath elements entirelypull/277/head
parent
1aee817be2
commit
8513fde92a
|
@ -127,7 +127,8 @@ class JailReader(ConfigReader):
|
||||||
|
|
||||||
stream = []
|
stream = []
|
||||||
for opt in self.__opts:
|
for opt in self.__opts:
|
||||||
if opt == "logpath":
|
if opt == "logpath" and \
|
||||||
|
self.__opts.get('backend', None) != "systemd":
|
||||||
found_files = 0
|
found_files = 0
|
||||||
for path in self.__opts[opt].split("\n"):
|
for path in self.__opts[opt].split("\n"):
|
||||||
pathList = glob.glob(path)
|
pathList = glob.glob(path)
|
||||||
|
@ -136,8 +137,7 @@ class JailReader(ConfigReader):
|
||||||
for p in pathList:
|
for p in pathList:
|
||||||
found_files += 1
|
found_files += 1
|
||||||
stream.append(["set", self.__name, "addlogpath", p])
|
stream.append(["set", self.__name, "addlogpath", p])
|
||||||
if not (found_files or allow_no_files or
|
if not (found_files or allow_no_files):
|
||||||
self.__opts.get('backend', None) == "systemd"):
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Have not found any log file for %s jail" % self.__name)
|
"Have not found any log file for %s jail" % self.__name)
|
||||||
elif opt == "logencoding":
|
elif opt == "logencoding":
|
||||||
|
|
Loading…
Reference in New Issue