Module: check_mk
Branch: master
Commit: 1d4bb97fba5a89c39984c89291972e676328cf7a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1d4bb97fba5a89…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Nov 11 11:43:36 2014 +0100
Avoid exception if some plugins directory is missing
---
web/htdocs/lib.py | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 37a7708..3477ca1 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -149,18 +149,18 @@ def gen_id():
# local-hierarchy for OMD
def load_web_plugins(forwhat, globalvars):
plugins_path = defaults.web_dir + "/plugins/" + forwhat
-
- fns = os.listdir(plugins_path)
- fns.sort()
- for fn in fns:
- file_path = plugins_path + "/" + fn
- if fn.endswith(".py"):
- if not os.path.exists(file_path + "c"):
- execfile(file_path, globalvars)
- elif fn.endswith(".pyc"):
- code_bytes = file(file_path).read()[8:]
- code = marshal.loads(code_bytes)
- exec code in globalvars
+ if os.path.exists(plugins_path):
+ fns = os.listdir(plugins_path)
+ fns.sort()
+ for fn in fns:
+ file_path = plugins_path + "/" + fn
+ if fn.endswith(".py"):
+ if not os.path.exists(file_path + "c"):
+ execfile(file_path, globalvars)
+ elif fn.endswith(".pyc"):
+ code_bytes = file(file_path).read()[8:]
+ code = marshal.loads(code_bytes)
+ exec code in globalvars
if defaults.omd_root:
local_plugins_path = defaults.omd_root +
"/local/share/check_mk/web/plugins/" + forwhat