From 54c4c8f55b80dcae08e00ff69ef4de2365cc0c7c Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 17 Feb 2015 00:12:02 +0100 Subject: FileMonitor/Pseudo: Only produce exists events, if file exists. The pseudo filemonitor created exists events, even if the file does not exists and the event handler raises an exception. Not it simply ignores non existing files and does not confuse the user with error messages. --- src/lib/Bcfg2/Server/FileMonitor/Pseudo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/Bcfg2/Server/FileMonitor/Pseudo.py b/src/lib/Bcfg2/Server/FileMonitor/Pseudo.py index b1e1adab7..9781e5b75 100644 --- a/src/lib/Bcfg2/Server/FileMonitor/Pseudo.py +++ b/src/lib/Bcfg2/Server/FileMonitor/Pseudo.py @@ -17,7 +17,8 @@ class Pseudo(FileMonitor): def AddMonitor(self, path, obj, handleID=None): if handleID is None: handleID = len(list(self.handles.keys())) - self.events.append(Event(handleID, path, 'exists')) + if os.path.exists(path): + self.events.append(Event(handleID, path, 'exists')) if os.path.isdir(path): dirlist = os.listdir(path) for fname in dirlist: -- cgit v1.2.3-1-g7c22