Browse Source

- Added a default value for each option

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@72 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.6
Cyril Jaquier 20 years ago
parent
commit
f0625224c7
  1. 15
      confreader/configreader.py

15
confreader/configreader.py

@ -34,9 +34,15 @@ class ConfigReader:
Fail2Ban. Each other section is for a different log file. Fail2Ban. Each other section is for a different log file.
""" """
optionValues = (["bool", "enabled"], ["str", "logfile"], # Each optionValues entry is composed of an array with:
["str", "timeregex"], ["str", "timepattern"], # 0 -> the type of the option
["str", "failregex"]) # 1 -> the name of the option
# 2 -> the default value for the option
optionValues = (["bool", "enabled", True],
["str", "logfile", "/dev/null"],
["str", "timeregex", ""],
["str", "timepattern", ""],
["str", "failregex", ""])
def __init__(self, logSys, confPath): def __init__(self, logSys, confPath):
self.confPath = confPath self.confPath = confPath
@ -70,6 +76,7 @@ class ConfigReader:
values[option[1]] = v values[option[1]] = v
except NoOptionError: except NoOptionError:
self.logSys.info("No "+option+" defined in "+sec) self.logSys.info("No '"+option[1]+"' defined in '"+sec+"'")
values[option[1]] = option[2]
return values return values
Loading…
Cancel
Save