Somehow on that elderly squeeze Debian sparc box, I got error that self.__notifier
was not defined. So first I did define it now in the constructor, but mystery remains
how come it was not defined -- wasn"t run() then run (where it is defined)?
Anyways -- conditioning on it being defined might be safer may be?
Not sure (need to go to sleep) if with this change but on this box I also run from time
to time either into stalling of fail2ban-testcases and refusing to exit normally or
======================================================================
ERROR: test_move_into_file_after_removed (testcases.filtertestcase.MonitorFailures<FilterPyinotify>(/tmp/monitorfailures_FilterPyinotifypcHmMJfail2ban))
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/yoh/deb/gits/fail2ban/testcases/filtertestcase.py", line 473, in tearDown
self.filter.stop()
File "/home/yoh/deb/gits/fail2ban/server/filterpyinotify.py", line 196, in stop
self.__notifier.stop()
File "/usr/lib/pymodules/python2.6/pyinotify.py", line 1315, in stop
threading.Thread.join(self)
File "/usr/lib/python2.6/threading.py", line 633, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started
that is with pyinotify 0.8.9-1 so could quite be "related" to its age.
When a file is deleted, the watcher for it is automatically removed.
FilterPyinotify is detecting a new file being created with the same
name, and in turn attempts to remove the watch for the deleted file
(which has already been removed automatically).
Also, IN_IGNORED events are generated when a file is deleted, but these
weren't being caught, causing an non-existent file path to be passed to
FilterPyinotify._process_file (which caught the exceptions in
Filter.getFailures).
* all of the *Filters had too much of common logic in their *LogPath
methods, which is now handled by FileFilter and derived classes only
add custom actions in corresponding _(add|del)LogPath methods
pyinotify:
* upon CREATE event:
- unknown files should not be handled at all
- "watcher" for the monitored files should be recreated.
Lead to adding _(add|del)FileWatcher helper methods
* callback now obtains full event to judge what to do