diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi index 29469febcecd22dd7f79cac36f69cc5d41a1cb71..ebc9280c0efb8df6151e45eccefee70320a75fbc 100755 --- a/daemons/ganeti-rapi +++ b/daemons/ganeti-rapi @@ -253,11 +253,12 @@ class FileEventHandler(asyncnotifier.FileEventHandlerBase): self._cb = cb self._filename = os.path.basename(path) - # Class '...' has no 'IN_...' member, pylint: disable-msg=E1103 - mask = (pyinotify.EventsCodes.IN_CLOSE_WRITE | - pyinotify.EventsCodes.IN_DELETE | - pyinotify.EventsCodes.IN_MOVED_FROM | - pyinotify.EventsCodes.IN_MOVED_TO) + # Different Pyinotify versions have the flag constants at different places, + # hence not accessing them directly + mask = (pyinotify.EventsCodes.ALL_FLAGS["IN_CLOSE_WRITE"] | + pyinotify.EventsCodes.ALL_FLAGS["IN_DELETE"] | + pyinotify.EventsCodes.ALL_FLAGS["IN_MOVED_FROM"] | + pyinotify.EventsCodes.ALL_FLAGS["IN_MOVED_TO"]) self._handle = self.AddWatch(os.path.dirname(path), mask) diff --git a/lib/asyncnotifier.py b/lib/asyncnotifier.py index e9b68cac9d4cb949fbd908b3c1633028b54ebf79..9d5610ee78df04fb6dd877a44db3167091881c92 100644 --- a/lib/asyncnotifier.py +++ b/lib/asyncnotifier.py @@ -153,9 +153,10 @@ class SingleFileEventHandler(FileEventHandlerBase): if self._watch_handle is not None: return - # Class '...' has no 'IN_...' member, pylint: disable-msg=E1103 - mask = (pyinotify.EventsCodes.IN_MODIFY | - pyinotify.EventsCodes.IN_IGNORED) + # Different Pyinotify versions have the flag constants at different places, + # hence not accessing them directly + mask = (pyinotify.EventsCodes.ALL_FLAGS["IN_MODIFY"] | + pyinotify.EventsCodes.ALL_FLAGS["IN_IGNORED"]) self._watch_handle = self.AddWatch(self._filename, mask)