- The options have a specified type now

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@65 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.6
Cyril Jaquier 2005-02-22 21:10:08 +00:00
parent 78b32ef3b2
commit 7b13c386f9
1 changed files with 11 additions and 3 deletions

View File

@ -34,7 +34,9 @@ class ConfigReader:
Fail2Ban. Each other section is for a different log file.
"""
optionValues = ("logfile", "timeregex", "timepattern", "failregex")
optionValues = (["bool", "enabled"], ["str", "logfile"],
["str", "timeregex"], ["str", "timepattern"],
["str", "failregex"])
def __init__(self, logSys, confPath):
self.confPath = confPath
@ -59,8 +61,14 @@ class ConfigReader:
values = dict()
for option in self.optionValues:
try:
v = self.configParser.get(sec, option)
values[option] = v
if option[0] == "bool":
v = self.configParser.getboolean(sec, option[1])
elif option[0] == "int":
v = self.configParser.getint(sec, option[1])
else:
v = self.configParser.get(sec, option[1])
values[option[1]] = v
except NoOptionError:
self.logSys.info("No "+option+" defined in "+sec)
return values