mirror of https://github.com/fail2ban/fail2ban
file-filter's: provide stop function in order to explicitly delete/stop monitoring of each file.
parent
81c86fa83f
commit
2bce0c5e3e
|
@ -1061,6 +1061,15 @@ class FileFilter(Filter):
|
||||||
ret.append(("File list", path))
|
ret.append(("File list", path))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
"""Stop monitoring of log-file(s)
|
||||||
|
"""
|
||||||
|
# stop files monitoring:
|
||||||
|
for path in self.__logs.keys():
|
||||||
|
self.delLogPath(path)
|
||||||
|
# stop thread:
|
||||||
|
super(Filter, self).stop()
|
||||||
|
|
||||||
##
|
##
|
||||||
# FileContainer class.
|
# FileContainer class.
|
||||||
#
|
#
|
||||||
|
|
|
@ -78,6 +78,7 @@ class FilterPyinotify(FileFilter):
|
||||||
self.__modified = False
|
self.__modified = False
|
||||||
# Pyinotify watch manager
|
# Pyinotify watch manager
|
||||||
self.__monitor = pyinotify.WatchManager()
|
self.__monitor = pyinotify.WatchManager()
|
||||||
|
self.__notifier = None
|
||||||
self.__watchFiles = dict()
|
self.__watchFiles = dict()
|
||||||
self.__watchDirs = dict()
|
self.__watchDirs = dict()
|
||||||
self.__pending = dict()
|
self.__pending = dict()
|
||||||
|
@ -240,7 +241,7 @@ class FilterPyinotify(FileFilter):
|
||||||
def _delFileWatcher(self, path):
|
def _delFileWatcher(self, path):
|
||||||
try:
|
try:
|
||||||
wdInt = self.__watchFiles.pop(path)
|
wdInt = self.__watchFiles.pop(path)
|
||||||
if not self._delWatch(wdInt): # pragma: no cover
|
if not self._delWatch(wdInt):
|
||||||
logSys.debug("Non-existing file watcher %r for file %s", wdInt, path)
|
logSys.debug("Non-existing file watcher %r for file %s", wdInt, path)
|
||||||
logSys.debug("Removed file watcher for %s", path)
|
logSys.debug("Removed file watcher for %s", path)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue