Skip to content
Snippets Groups Projects
Commit ad54f3d2 authored by Guido Trotter's avatar Guido Trotter
Browse files

Change pyinotify import for broader compatibility


On some distributions pyinotify is installed in a different way, and the
actual module just contains an internal pyinotify entry, which is the
actual library. On others the main pyinotify module contains the library
itself. We'll try both, in order to be more compatible.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
parent 43dc8496
No related branches found
No related tags found
No related merge requests found
...@@ -29,9 +29,13 @@ It uses UDP+HMAC for authentication with a global cluster key. ...@@ -29,9 +29,13 @@ It uses UDP+HMAC for authentication with a global cluster key.
import os import os
import sys import sys
import logging import logging
import pyinotify
import time import time
try:
from pyinotify import pyinotify
except ImportError:
import pyinotify
from optparse import OptionParser from optparse import OptionParser
from ganeti import asyncnotifier from ganeti import asyncnotifier
......
...@@ -22,9 +22,13 @@ ...@@ -22,9 +22,13 @@
"""Asynchronous pyinotify implementation""" """Asynchronous pyinotify implementation"""
import pyinotify
import asyncore import asyncore
try:
from pyinotify import pyinotify
except ImportError:
import pyinotify
class AsyncNotifier(asyncore.file_dispatcher): class AsyncNotifier(asyncore.file_dispatcher):
"""An asyncore dispatcher for inotify events. """An asyncore dispatcher for inotify events.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment