Module: check_mk
Branch: master
Commit: 8a500315a40c7ae825b57c84126763cf8ddcfa60
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a500315a40c7a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Sep 16 14:14:31 2016 +0200
Cleanup: moved handling of livestatus proxy connection from sites.py to config.py
---
livestatus/.f12 | 1 +
web/htdocs/config.py | 21 ++++++++++++---------
web/htdocs/sites.py | 8 --------
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/livestatus/.f12 b/livestatus/.f12
index 9d4dcf1..25503b2 100755
--- a/livestatus/.f12
+++ b/livestatus/.f12
@@ -6,5 +6,6 @@ set -e
make -C .. livestatus/config.h
make -j8
sudo install src/livestatus.o /omd/sites/$SITE/lib/mk-livestatus/livestatus.o
+(cd api/python ; .f12 )
echo "Restarting site $SITE"
sudo omd restart $SITE nagios
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index a9175de..3e4f88a 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -551,17 +551,20 @@ def sorted_sites():
return sitenames
-def site(name):
- s = sites.get(name, {})
+
+def site(site_id):
+ s = dict(sites.get(site_id, {}))
# Now make sure that all important keys are available.
# Add missing entries by supplying default values.
- if "alias" not in s:
- s["alias"] = name
- if "socket" not in s:
- s["socket"] = "unix:" + defaults.livestatus_unix_socket
- if "url_prefix" not in s:
- s["url_prefix"] = "../" # relative URL from /check_mk/
- s["id"] = name
+ s.setdefault("alias", site_id)
+ s.setdefault("socket", "unix:" +
defaults.livestatus_unix_socket)
+ s.setdefault("url_prefix", "../") # relative URL from /check_mk/
+ if type(s["socket"]) == tuple and s["socket"][0] ==
"proxy":
+ s["cache"] = s["socket"][1].get("cache", True)
+ s["socket"] = "unix:" + defaults.livestatus_unix_socket +
"proxy/" + site_id
+ else:
+ s["cache"] = False
+ s["id"] = site_id
return s
diff --git a/web/htdocs/sites.py b/web/htdocs/sites.py
index da1c666..f269dfa 100644
--- a/web/htdocs/sites.py
+++ b/web/htdocs/sites.py
@@ -143,14 +143,6 @@ def _get_enabled_and_disabled_sites():
for site_id, site in config.allsites().items():
siteconf = config.user_siteconf.get(site_id, {})
- # Convert livestatus-proxy links into UNIX socket
- s = site["socket"]
- if type(s) == tuple and s[0] == "proxy":
- site["socket"] = "unix:" +
defaults.livestatus_unix_socket + "proxy/" + site_id
- site["cache"] = s[1].get("cache", True)
- else:
- site["cache"] = False
-
if siteconf.get("disabled", False):
disabled_sites[site_id] = site
else: