Module: check_mk
Branch: master
Commit: 6614fe83353660e70d3a8eaa2d4c4a91b6c63e44
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6614fe83353660…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 11 10:14:26 2018 +0200
5969 FIX Fixed possible "params" exception when editing sites after update
When trying to edit an existing site configuration a "params" exception
could occur. This happened when at least one configured site is configured
to use the livestatus proxy.
Change-Id: I9369527f905e238c6a422f1667f2825eb7693f28
---
.werks/5969 | 13 ++++++++++++
web/htdocs/watolib.py | 58 ++++++++++++++++++++++++++-------------------------
2 files changed, 43 insertions(+), 28 deletions(-)
diff --git a/.werks/5969 b/.werks/5969
new file mode 100644
index 0000000..c769922
--- /dev/null
+++ b/.werks/5969
@@ -0,0 +1,13 @@
+Title: Fixed possible "params" exception when editing sites after update
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0b2
+Date: 1523434352
+
+When trying to edit an existing site configuration a "params" exception
+could occur. This happened when at least one configured site is configured
+to use the livestatus proxy.
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 6c895f9..aef3b35 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3964,34 +3964,30 @@ class CRESiteManagement(object):
@classmethod
def load_sites(cls):
- try:
- if not os.path.exists(sites_mk):
- return config.default_single_site_configuration()
-
- vars = { "sites" : {} }
- execfile(sites_mk, vars, vars)
-
- # Be compatible to old "disabled" value in socket attribute.
- # Can be removed one day.
- for site in vars['sites'].values():
- if site.get('socket') == 'disabled':
- site['disabled'] = True
- del site['socket']
-
- if not vars["sites"]:
- # There seem to be installations out there which have a sites.mk
- # which has an empty sites dictionary. Apply the default configuration
- # for these sites too.
- return config.default_single_site_configuration()
- else:
- return vars["sites"]
-
-
- except Exception, e:
- if config.debug:
- raise MKGeneralException(_("Cannot read configuration file %s:
%s") %
- (sites_mk, e))
- return {}
+ if not os.path.exists(sites_mk):
+ return config.default_single_site_configuration()
+
+ vars = { "sites" : {} }
+ execfile(sites_mk, vars, vars)
+
+ # Be compatible to old "disabled" value in socket attribute.
+ # Can be removed one day.
+ for site_id, site in vars['sites'].items():
+ socket = site.get("socket")
+ if socket == 'disabled':
+ site['disabled'] = True
+ del site['socket']
+
+ elif type(socket) == tuple and socket[0] == "proxy":
+ site["socket"] = ("proxy",
cls.transform_old_connection_params(socket[1]))
+
+ if not vars["sites"]:
+ # There seem to be installations out there which have a sites.mk
+ # which has an empty sites dictionary. Apply the default configuration
+ # for these sites too.
+ return config.default_single_site_configuration()
+ else:
+ return vars["sites"]
@classmethod
@@ -4051,6 +4047,12 @@ class CRESiteManagement(object):
return [ConfigDomainGUI]
+ @classmethod
+ def transform_old_connection_params(cls, value):
+ return value
+
+
+
SiteManagement = CRESiteManagement