ConfdInotifyEventHandler.enable: use InotifyError
authorGuido Trotter <ultrotter@google.com>
Sun, 23 Aug 2009 15:57:48 +0000 (16:57 +0100)
committerGuido Trotter <ultrotter@google.com>
Fri, 28 Aug 2009 11:08:04 +0000 (14:08 +0300)
Rather than raising ConfdFatalError directly
ConfdInotifyEventHandler.enable raises InotifyError should it not be
able to configure inotify, allowing the caller to decide what to do.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

daemons/ganeti-confd

index 9deb123..34d08f3 100755 (executable)
@@ -123,7 +123,7 @@ class ConfdInotifyEventHandler(pyinotify.ProcessEvent):
     if self.watch_handle is None:
       result = self.watch_manager.add_watch(self.file, self.mask)
       if not self.file in result or result[self.file] <= 0:
-        raise errors.ConfdFatalError("Could not add inotify watcher")
+        raise errors.InotifyError("Could not add inotify watcher")
       else:
         self.watch_handle = result[self.file]
 
@@ -213,7 +213,10 @@ class ConfdConfigurationReloader(object):
 
     """
     if not notifier_enabled:
-      self.inotify_handler.enable()
+      try:
+        self.inotify_handler.enable()
+      except errors.InotifyError:
+        raise errors.ConfdFatalError(err)
 
     try:
       reloaded = self.reader.Reload()