Module: check_mk
Branch: master
Commit: 2e014a8005668bda195490e15ee70821bfdc4aa7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e014a8005668b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Oct 29 11:00:55 2011 +0200
WATO: move multisite config files to multisite.d/wato/
---
web/htdocs/config.py | 16 +++++++++++-----
web/htdocs/wato.py | 4 +++-
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index f700ebc..90d52ce 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -101,13 +101,19 @@ def load_config():
wato_host_tags = []
include("multisite.mk")
- # Load also all files below multisite.d
+
+ # Load also recursively all files below multisite.d
conf_dir = defaults.default_config_dir + "/multisite.d"
+ filelist = []
if os.path.isdir(conf_dir):
- filelist = glob.glob(conf_dir + "/*.mk")
- filelist.sort()
- for p in filelist:
- include(p)
+ for root, dirs, files in os.walk(conf_dir):
+ for filename in files:
+ if filename.endswith(".mk"):
+ filelist.append(root + "/" + filename)
+
+ filelist.sort()
+ for p in filelist:
+ include(p)
# -------------------------------------------------------------------
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 3fe1acb..7e3ac9b 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -241,7 +241,7 @@ config.declare_permission("wato.snapshots",
root_dir = defaults.check_mk_configdir + "/wato/"
-multisite_dir = defaults.default_config_dir + "/multisite.d/"
+multisite_dir = defaults.default_config_dir + "/multisite.d/wato/"
var_dir = defaults.var_dir + "/wato/"
log_dir = var_dir + "log/"
snapshot_dir = var_dir + "/snapshots/"
@@ -5583,6 +5583,7 @@ def load_sites():
def save_sites(sites):
+ make_nagios_directory(multisite_dir)
filename = multisite_dir + "sites.mk"
if len(sites) == 0:
if os.path.exists(filename):
@@ -7946,6 +7947,7 @@ def mode_edit_rule(phase):
def save_rulesets(folder, rulesets):
+ make_nagios_directory(root_dir)
path = root_dir + '/' + folder['.path'] + '/' +
"rules.mk"
out = file(path, "w")
out.write("# Written by WATO\n# encoding: utf-8\n\n")