diff --git a/fail2ban/server/filterpyinotify.py b/fail2ban/server/filterpyinotify.py index 2ee49169..81bc7de3 100644 --- a/fail2ban/server/filterpyinotify.py +++ b/fail2ban/server/filterpyinotify.py @@ -173,7 +173,9 @@ class FilterPyinotify(FileFilter): if not chkpath(path): # not found - prolong for next time if retardTM < 60: retardTM *= 2 if minTime > retardTM: minTime = retardTM - self.__pending[path][0] = retardTM + try: + self.__pending[path][0] = retardTM + except KeyError: pass continue logSys.log(logging.MSG, "Log presence detected for %s %s", "directory" if isDir else "file", path) diff --git a/fail2ban/tests/clientreadertestcase.py b/fail2ban/tests/clientreadertestcase.py index 1baff568..0388fd3d 100644 --- a/fail2ban/tests/clientreadertestcase.py +++ b/fail2ban/tests/clientreadertestcase.py @@ -61,6 +61,7 @@ class ConfigReaderTest(unittest.TestCase): def tearDown(self): """Call after every test case.""" shutil.rmtree(self.d) + super(ConfigReaderTest, self).tearDown() def _write(self, fname, value=None, content=None): # verify if we don't need to create .d directory diff --git a/fail2ban/tests/sockettestcase.py b/fail2ban/tests/sockettestcase.py index 4eb3a375..5c674620 100644 --- a/fail2ban/tests/sockettestcase.py +++ b/fail2ban/tests/sockettestcase.py @@ -54,7 +54,6 @@ class Socket(LogCaptureTestCase): def setUp(self): """Call before every test case.""" - LogCaptureTestCase.setUp(self) super(Socket, self).setUp() self.server = AsyncServer(self) sock_fd, sock_name = tempfile.mkstemp('fail2ban.sock', 'f2b-socket') @@ -68,7 +67,7 @@ class Socket(LogCaptureTestCase): if self.serverThread: self.server.stop(); # stop if not already stopped self._stopServerThread() - LogCaptureTestCase.tearDown(self) + super(Socket, self).tearDown() @staticmethod def proceed(message):