mirror of https://github.com/fail2ban/fail2ban
fixes gh-3635: avoid sporadic error in pyinotify backend if pending file deleted in other thread; restore correct logging in tests
commit
44fa2959e7
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue