From 7eb951a59f1d32225e245dc61d6195e977d85624 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 24 Sep 2009 04:00:01 +0000 Subject: Decisions: Catch initialization error for non-existent Decisions directory Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5456 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/Decisions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/Server/Plugins/Decisions.py b/src/lib/Server/Plugins/Decisions.py index 101a85fba..95db433a7 100644 --- a/src/lib/Server/Plugins/Decisions.py +++ b/src/lib/Server/Plugins/Decisions.py @@ -1,4 +1,7 @@ -import Bcfg2.Server.Plugin, lxml.etree +import logging +import lxml.etree +import Bcfg2.Server.Plugin +logger = logging.getLogger('Bcfg2.Plugins.Decisions') class DecisionFile(Bcfg2.Server.Plugin.SpecificData): def handle_event(self, event): @@ -20,7 +23,12 @@ class DecisionSet(Bcfg2.Server.Plugin.EntrySet): pattern = '(white|black)list' Bcfg2.Server.Plugin.EntrySet.__init__(self, pattern, path, \ DecisionFile, encoding) - fam.AddMonitor(path, self) + try: + fam.AddMonitor(path, self) + except OSError, e: + logger.error('Adding filemonitor for %s failed. ' + 'Make sure directory exists' % path) + raise Bcfg2.Server.Plugin.PluginInitError(e) def HandleEvent(self, event): if event.filename != self.path: -- cgit v1.2.3-1-g7c22