summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-20 14:03:40 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-20 14:03:40 -0400
commit62fe861b93d08077ed2467855f95bf2c437f003b (patch)
tree6cdfc90dfc908cb3eceaa1628656092f10bad740
parentfc3eb5bea78abfac86f0f4841f691272e118b7a6 (diff)
downloadbcfg2-62fe861b93d08077ed2467855f95bf2c437f003b.tar.gz
bcfg2-62fe861b93d08077ed2467855f95bf2c437f003b.tar.bz2
bcfg2-62fe861b93d08077ed2467855f95bf2c437f003b.zip
Inotify: produce better error when watching non-existent directory or file in such
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/Inotify.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
index 178a47b1a..b44ff6970 100644
--- a/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
+++ b/src/lib/Bcfg2/Server/FileMonitor/Inotify.py
@@ -2,6 +2,7 @@
support. """
import os
+import errno
import logging
import pyinotify
from Bcfg2.Compat import reduce # pylint: disable=W0622
@@ -182,6 +183,9 @@ class Inotify(Pseudo, pyinotify.ProcessEvent):
try:
watchdir = self.watches_by_path[watch_path]
except KeyError:
+ if not os.path.exists(watch_path):
+ raise OSError(errno.ENOENT,
+ "No such file or directory: '%s'" % path)
watchdir = self.watchmgr.add_watch(watch_path, self.mask,
quiet=False)[watch_path]
self.watches_by_path[watch_path] = watchdir