From 7b13c386f970936affa8c212a40648552d52eff8 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Tue, 22 Feb 2005 21:10:08 +0000 Subject: [PATCH] - The options have a specified type now git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@65 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- confreader/configreader.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/confreader/configreader.py b/confreader/configreader.py index 1b43cf4f..bd2aaba0 100644 --- a/confreader/configreader.py +++ b/confreader/configreader.py @@ -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