mirror of https://github.com/fail2ban/fail2ban
code review + coverage fixes
parent
62e580b7cf
commit
050076ae42
|
@ -137,6 +137,7 @@ class FilterPyinotify(FileFilter):
|
||||||
TODO -- RF:
|
TODO -- RF:
|
||||||
this is a common logic and must be shared/provided by FileFilter
|
this is a common logic and must be shared/provided by FileFilter
|
||||||
"""
|
"""
|
||||||
|
if not self.idle:
|
||||||
self.getFailures(path)
|
self.getFailures(path)
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
@ -268,7 +269,7 @@ class FilterPyinotify(FileFilter):
|
||||||
# @param path the log file to delete
|
# @param path the log file to delete
|
||||||
|
|
||||||
def _delLogPath(self, path):
|
def _delLogPath(self, path):
|
||||||
if not self._delFileWatcher(path):
|
if not self._delFileWatcher(path): # pragma: no cover
|
||||||
logSys.error("Failed to remove watch on path: %s", path)
|
logSys.error("Failed to remove watch on path: %s", path)
|
||||||
self._delPending(path)
|
self._delPending(path)
|
||||||
|
|
||||||
|
@ -315,14 +316,12 @@ class FilterPyinotify(FileFilter):
|
||||||
if Utils.wait_for(lambda: not self.active or not self.idle,
|
if Utils.wait_for(lambda: not self.active or not self.idle,
|
||||||
self.sleeptime * 10, self.sleeptime
|
self.sleeptime * 10, self.sleeptime
|
||||||
):
|
):
|
||||||
if not self.active:
|
if not self.active: break
|
||||||
break
|
|
||||||
|
|
||||||
# default pyinotify handling using Notifier:
|
# default pyinotify handling using Notifier:
|
||||||
self.__notifier.process_events()
|
self.__notifier.process_events()
|
||||||
if Utils.wait_for(lambda: not self.active or self.__notifier.check_events(), self.sleeptime):
|
if Utils.wait_for(lambda: not self.active or self.__notifier.check_events(), self.sleeptime):
|
||||||
if not self.active:
|
if not self.active: break
|
||||||
break
|
|
||||||
self.__notifier.read_events()
|
self.__notifier.read_events()
|
||||||
|
|
||||||
# check pending files/dirs (logrotate ready):
|
# check pending files/dirs (logrotate ready):
|
||||||
|
@ -353,9 +352,6 @@ class FilterPyinotify(FileFilter):
|
||||||
# stop filter thread:
|
# stop filter thread:
|
||||||
super(FilterPyinotify, self).stop()
|
super(FilterPyinotify, self).stop()
|
||||||
self.join()
|
self.join()
|
||||||
if self.__notifier: # stop the notifier
|
|
||||||
self.__notifier.stop()
|
|
||||||
self.__notifier.stop = lambda *args: 0; # prevent dual stop
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Wait for exit with cleanup.
|
# Wait for exit with cleanup.
|
||||||
|
|
Loading…
Reference in New Issue