mirror of https://github.com/fail2ban/fail2ban
BF: corrected tests for missing jail
Previously tests relied on the missing filter to trigger the conditions required for a missing jail. We now handle this explicitly.pull/484/head
parent
3ddf8da76e
commit
d74dd31d23
|
@ -112,7 +112,7 @@ class ConfigReader(SafeConfigParserWithIncludes):
|
||||||
except NoSectionError, e:
|
except NoSectionError, e:
|
||||||
# No "Definition" section or wrong basedir
|
# No "Definition" section or wrong basedir
|
||||||
logSys.error(e)
|
logSys.error(e)
|
||||||
values[option[1]] = option[2]
|
return False
|
||||||
except NoOptionError:
|
except NoOptionError:
|
||||||
if not option[2] is None:
|
if not option[2] is None:
|
||||||
logSys.warn("'%s' not defined in '%s'. Using default one: %r"
|
logSys.warn("'%s' not defined in '%s'. Using default one: %r"
|
||||||
|
|
|
@ -54,7 +54,7 @@ class JailReader(ConfigReader):
|
||||||
return ConfigReader.read(self, "jail")
|
return ConfigReader.read(self, "jail")
|
||||||
|
|
||||||
def isEnabled(self):
|
def isEnabled(self):
|
||||||
return self.__force_enable or self.__opts["enabled"]
|
return self.__force_enable or ( self.__opts and self.__opts["enabled"] )
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _glob(path):
|
def _glob(path):
|
||||||
|
@ -84,6 +84,8 @@ class JailReader(ConfigReader):
|
||||||
["string", "filter", ""],
|
["string", "filter", ""],
|
||||||
["string", "action", ""]]
|
["string", "action", ""]]
|
||||||
self.__opts = ConfigReader.getOptions(self, self.__name, opts)
|
self.__opts = ConfigReader.getOptions(self, self.__name, opts)
|
||||||
|
if not self.__opts:
|
||||||
|
return False
|
||||||
|
|
||||||
if self.isEnabled():
|
if self.isEnabled():
|
||||||
# Read filter
|
# Read filter
|
||||||
|
|
Loading…
Reference in New Issue