From ad54f3d2e3a370a1b8db3d6fb0ecbebcf0f37f88 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 10 Dec 2009 13:46:48 +0000 Subject: [PATCH] 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: Guido Trotter <ultrotter@google.com> --- daemons/ganeti-confd | 6 +++++- lib/asyncnotifier.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/daemons/ganeti-confd b/daemons/ganeti-confd index c560e7fdd..b3cf68841 100755 --- a/daemons/ganeti-confd +++ b/daemons/ganeti-confd @@ -29,9 +29,13 @@ It uses UDP+HMAC for authentication with a global cluster key. import os import sys import logging -import pyinotify import time +try: + from pyinotify import pyinotify +except ImportError: + import pyinotify + from optparse import OptionParser from ganeti import asyncnotifier diff --git a/lib/asyncnotifier.py b/lib/asyncnotifier.py index 1498ad0e6..a0fb2d093 100644 --- a/lib/asyncnotifier.py +++ b/lib/asyncnotifier.py @@ -22,9 +22,13 @@ """Asynchronous pyinotify implementation""" -import pyinotify import asyncore +try: + from pyinotify import pyinotify +except ImportError: + import pyinotify + class AsyncNotifier(asyncore.file_dispatcher): """An asyncore dispatcher for inotify events. -- GitLab