Module: check_mk
Branch: master
Commit: c6bf2d3a7a28ce838e2a70fdfc4aa3e36486a481
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c6bf2d3a7a28ce…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Feb 26 12:14:15 2016 +0100
#3247 FIX Do not allow multiple BI aggregates with the same title
Doing that leads into several anomalies and strange behaviour. The BI
titles must be unique. This is now enforced and an error printed in
cased.
---
.werks/3247 | 12 ++++++++++++
ChangeLog | 3 +++
web/htdocs/bi.py | 17 +++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/.werks/3247 b/.werks/3247
new file mode 100644
index 0000000..36528e5
--- /dev/null
+++ b/.werks/3247
@@ -0,0 +1,12 @@
+Title: Do not allow multiple BI aggregates with the same title
+Level: 2
+Component: bi
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456485207
+
+Doing that leads into several anomalies and strange behaviour. The BI
+titles must be unique. This is now enforced and an error printed in
+cased.
diff --git a/ChangeLog b/ChangeLog
index fde18f8..339165b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -71,6 +71,9 @@
* 2998 FIX: Fixed broken WATO rules where content is dynamically loaded...
* 3246 FIX: Fix link for editing a BI aggregation after coming back from the details
of another aggregation...
+ BI:
+ * 3247 FIX: Do not allow multiple BI aggregates with the same title...
+
Event Console:
* 3058 FIX: Event Console is now allowing non loadable MIB modules on startup...
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 3b3dc7c..d6033a2 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -422,6 +422,8 @@ def compile_forest(user, only_hosts = None, only_groups = None):
# Remember successful compile in cache
g_cache[user] = cache
+ check_title_uniqueness(cache["forest"])
+
if compile_logging():
num_total_aggr = 0
for grp, aggrs in cache['forest'].iteritems():
@@ -464,6 +466,21 @@ def compile_forest(user, only_hosts = None, only_groups = None):
len(config.host_aggregations),
))
+
+def check_title_uniqueness(forest):
+ known_titles = set()
+ for group, aggrs in forest.iteritems():
+ for aggr in aggrs:
+ title = aggr["title"]
+ if title in known_titles:
+ raise MKConfigError(_("Duplicate BI aggregation with the title
\"<b>%s</b>\". "
+ "Please check your BI configuration and make sure that
within each group no aggregation has "
+ "the same title as any other. Note: you can use arguments
in the top level "
+ "aggregation rule, like <tt>Host
$HOST$</tt>.") % (
+ html.attrencode(title)))
+ else:
+ known_titles.add(title)
+
def compile_logging():
return config.bi_compile_log is not None