mirror of https://github.com/fail2ban/fail2ban
BF: guarantee order of dbfile to be before dbpurgeage (Closes #1048)
parent
0041bc3770
commit
17472a8b56
|
@ -139,6 +139,7 @@ class Transmitter:
|
||||||
elif name == "dbpurgeage":
|
elif name == "dbpurgeage":
|
||||||
db = self.__server.getDatabase()
|
db = self.__server.getDatabase()
|
||||||
if db is None:
|
if db is None:
|
||||||
|
logSys.warning("dbpurgeage setting was not in effect since no db yet")
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
db.purgeage = command[1]
|
db.purgeage = command[1]
|
||||||
|
|
|
@ -622,6 +622,21 @@ class JailsReaderTest(LogCaptureTestCase):
|
||||||
configurator.getOptions()
|
configurator.getOptions()
|
||||||
configurator.convertToProtocol()
|
configurator.convertToProtocol()
|
||||||
commands = configurator.getConfigStream()
|
commands = configurator.getConfigStream()
|
||||||
|
|
||||||
|
# verify that dbfile comes before dbpurgeage
|
||||||
|
def find_set(option):
|
||||||
|
for i, e in enumerate(commands):
|
||||||
|
if e[0] == 'set' and e[1] == option:
|
||||||
|
return i
|
||||||
|
raise ValueError("Did not find command 'set %s' among commands %s"
|
||||||
|
% (option, commands))
|
||||||
|
|
||||||
|
# Set up of logging should come first
|
||||||
|
self.assertEqual(find_set('logtarget'), 1)
|
||||||
|
self.assertEqual(find_set('loglevel'), 2)
|
||||||
|
# then dbfile should be before dbpurgeage
|
||||||
|
self.assertGreater(find_set('dbpurgeage'), find_set('dbfile'))
|
||||||
|
|
||||||
# and there is logging information left to be passed into the
|
# and there is logging information left to be passed into the
|
||||||
# server
|
# server
|
||||||
self.assertEqual(sorted(commands),
|
self.assertEqual(sorted(commands),
|
||||||
|
|
Loading…
Reference in New Issue