amend with missing parameter of actionreban in actionreader and coverage

pull/2588/head
sebres 2020-01-07 21:31:21 +01:00
parent f001f8de2a
commit 17a34b1528
3 changed files with 9 additions and 2 deletions

View File

@ -46,6 +46,7 @@ class ActionReader(DefinitionInitConfigReader):
"actionrepair": ["string", None],
"actionrepair_on_unban": ["string", None],
"actionban": ["string", None],
"actionreban": ["string", None],
"actionunban": ["string", None],
"norestored": ["string", None],
}

View File

@ -493,8 +493,7 @@ class Actions(JailThread, Mapping):
(name, action) for name, action in self._actions.iteritems()
if action.banEpoch > bTicket.banEpoch)
cnt += self.__reBan(bTicket, actions=rebanacts)
else:
# pragma: no cover - unexpected: ticket is not banned for some reasons - reban using all actions:
else: # pragma: no cover - unexpected: ticket is not banned for some reasons - reban using all actions:
cnt += self.__reBan(bTicket)
if cnt:
logSys.debug("Banned %s / %s, %s ticket(s) in %r", cnt,

View File

@ -495,3 +495,10 @@ class ExecuteActions(LogCaptureTestCase):
'2001:db8::2 inet6 -- rebanned', all=True)
self.assertNotLogged('192.0.2.1 inet4 -- rebanned')
# coverage - intended error in reban (no unhandled exception, message logged):
act.actionreban = ''
act.actionban = 'exit 1'
self.assertEqual(self.__actions._Actions__reBan(FailTicket("192.0.2.1", 0)), 0)
self.assertLogged(
'Failed to execute reban',
'Error banning 192.0.2.1', all=True)