From ac5242815fbc717d6da52516863ef38ff4a855f2 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 15 Oct 2005 05:14:56 +0000 Subject: [PATCH] fixed an issue with command line parameters --- confreader/configreader.py | 8 +++++++- debian/changelog | 3 ++- fail2ban.py | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/confreader/configreader.py b/confreader/configreader.py index 336a36e0..295eb043 100644 --- a/confreader/configreader.py +++ b/confreader/configreader.py @@ -54,6 +54,12 @@ class ConfigReader: sections.remove("MAIL") logSys.debug("Found sections: " + `sections`) return sections + + def setValue(self, sec, label, value): + """ Override a value for a section + """ + self.configParser.set(sec, label, value) + # Each optionValues entry is composed of an array with: # 0 -> the type of the option @@ -82,4 +88,4 @@ class ConfigReader: "'. Using default one: '" + `option[2]` + "'") values[option[1]] = option[2] return values - \ No newline at end of file + diff --git a/debian/changelog b/debian/changelog index 9ccdab1b..9ca5040a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,7 +16,8 @@ fail2ban (0.5.4-5.11) unstable; urgency=low case if check of fwban or fwban command failed (closes: #329163, #331695). (Introduced patch was further adjusted by upstream author) * Added -f command line parameter for [findtime] - * Fixing the issue of not respecting command line parameters + * Fixed the issue of not respecting command line parameters for parameters + within sections -- Yaroslav Halchenko Mon, 3 Oct 2005 22:26:28 -1000 diff --git a/fail2ban.py b/fail2ban.py index 5a6eeee3..30247269 100755 --- a/fail2ban.py +++ b/fail2ban.py @@ -228,6 +228,13 @@ def main(): # Gets command line options getCmdLineOptions(optList) + + # Now we need to update confReader.configParser with 'commandline' + # overwritten parameters. There is no way to assign configParser + # with defaults (as I thought before) below in the code: thus defaults + # have to be overridden + for t, label, v in optionValues: + confReader.setValue("DEFAULT", label, `conf[label]`) # PID lock pidLock.setPath(conf["pidlock"])