mirror of https://github.com/fail2ban/fail2ban
ENH: raise an exception if not a single file was found for the jail. Close #63
parent
b6be8b8243
commit
27947407bc
|
@ -107,12 +107,17 @@ class JailReader(ConfigReader):
|
||||||
stream = []
|
stream = []
|
||||||
for opt in self.__opts:
|
for opt in self.__opts:
|
||||||
if opt == "logpath":
|
if opt == "logpath":
|
||||||
|
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)
|
||||||
if len(pathList) == 0:
|
if len(pathList) == 0:
|
||||||
logSys.error("No file found for " + path)
|
logSys.error("No file(s) found for glob %s" % path)
|
||||||
for p in pathList:
|
for p in pathList:
|
||||||
|
found_files += 1
|
||||||
stream.append(["set", self.__name, "addlogpath", p])
|
stream.append(["set", self.__name, "addlogpath", p])
|
||||||
|
if not found_files:
|
||||||
|
raise ValueError(
|
||||||
|
"Have not found any log file for %s jail" % self.__name)
|
||||||
elif opt == "backend":
|
elif opt == "backend":
|
||||||
backend = self.__opts[opt]
|
backend = self.__opts[opt]
|
||||||
elif opt == "maxretry":
|
elif opt == "maxretry":
|
||||||
|
|
Loading…
Reference in New Issue