summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-02-17 00:12:02 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2015-02-17 17:26:07 +0100
commit54c4c8f55b80dcae08e00ff69ef4de2365cc0c7c (patch)
treefe69ea01d4eaee6a08896a39c2b895ba760974c3
parentbcf569ca082511fefa1552e623d1ce5095ef5399 (diff)
downloadbcfg2-54c4c8f55b80dcae08e00ff69ef4de2365cc0c7c.tar.gz
bcfg2-54c4c8f55b80dcae08e00ff69ef4de2365cc0c7c.tar.bz2
bcfg2-54c4c8f55b80dcae08e00ff69ef4de2365cc0c7c.zip
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.
-rw-r--r--src/lib/Bcfg2/Server/FileMonitor/Pseudo.py3
1 files changed, 2 insertions, 1 deletions
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: