From 25916ca619bf5aaccf56ff237603e9aaae2f91c2 Mon Sep 17 00:00:00 2001
From: Anael Beutot <anael.beutot@smartjog.com>
Date: Fri, 10 Aug 2012 16:35:22 +0200
Subject: [PATCH] Catch exception for jobs storage directory

---
 cloudcontrol/node/host/__init__.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/cloudcontrol/node/host/__init__.py b/cloudcontrol/node/host/__init__.py
index 813c034..64092be 100644
--- a/cloudcontrol/node/host/__init__.py
+++ b/cloudcontrol/node/host/__init__.py
@@ -193,8 +193,13 @@ class Handler(BasePlugin):
         self.shells = dict()
 
         #: jobs manager (different from MainLoop.jobs_manager)
-        self.jobs_manager = JobsManager(logger, NodeJobsManagerInterface(self),
-                                       JobsStore(self.main.config.jobs_store_path))
+        try:
+            self.jobs_manager = JobsManager(logger, NodeJobsManagerInterface(self),
+                                           JobsStore(self.main.config.jobs_store_path))
+        except EnvironmentError as e:
+            logger.critical('Cannot access jobs directory: %s', e.strerror)
+            self.main.stop()
+            raise
 
         #: loaded plugins
         self.plugins = {}  # plugin name -> plugin object
-- 
GitLab