Module: check_mk
Branch: master
Commit: d48bdbcb699dff2e2a98e70be668f5b3a7c7a3de
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d48bdbcb699dff…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 29 12:18:43 2015 +0100
#2670 FIX Fix problem that no site is configured when user has deleted only site
This problem was introduced by dropping the "single site" mode internally totally
in version 1.2.7i3 and treating a single site setup automatically as multi site
setup with just one site. The problem occurred when you had <tt>sites = {}</tt>
in your configuration (instead of having no <tt>sites = </tt> at all).
---
.werks/2670 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/config.py | 8 +++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/.werks/2670 b/.werks/2670
new file mode 100644
index 0000000..49909c2
--- /dev/null
+++ b/.werks/2670
@@ -0,0 +1,12 @@
+Title: Fix problem that no site is configured when user has deleted only site
+Level: 2
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1446117423
+Class: fix
+
+This problem was introduced by dropping the "single site" mode internally totally
+in version 1.2.7i3 and treating a single site setup automatically as multi site
+setup with just one site. The problem occurred when you had <tt>sites = {}</tt>
+in your configuration (instead of having no <tt>sites = </tt> at all).
diff --git a/ChangeLog b/ChangeLog
index 12497f6..e5c4f35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@
* 2689 FIX: LDAP: Fixed broken sync when using "Filter Group" in the user sync settings
* 2438 FIX: Manpage icons: fixed manpage links for active checks
* 2691 FIX: Fixed exception in host address painter when displaying hosts/services of older sites
+ * 2670 FIX: Fix problem that no site is configured when user has deleted only site...
WATO:
* 2666 FIX: Fix search for global configuration variables: ignore case now
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index cdc4239..0a0051d 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -141,7 +141,7 @@ def include(filename):
# Load multisite.mk and all files in multisite.d/. This will happen
# for *each* HTTP request.
def load_config():
- global modification_timestamps
+ global modification_timestamps, sites
modification_timestamps = []
# Set default values for all user-changable configuration settings
@@ -163,6 +163,12 @@ def load_config():
for p in filelist:
include(p)
+ # Prevent problem when user has deleted all sites from his configuration
+ # and sites is {}. We assume a default single site configuration in
+ # that case.
+ if not sites:
+ sites = default_single_site_configuration()
+
def reporting_available():
try: