Module: check_mk
Branch: master
Commit: 6f1e06d16051dfecd5fd4ce54a933e7e2408bc25
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6f1e06d16051df…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Oct 10 16:47:12 2017 +0200
5318 FIX BI aggregations can be configured to be in multiple groups
Previously if more than one group were stated in the
configuration of any aggregation, the related view displayed
an error {{Duplicate BI aggregation}}. Fixed that.
Change-Id: Ibc5fe5d35443e97018125f8dfe350192a057ed62
---
.werks/5318 | 13 +++++++++++++
web/htdocs/bi.py | 19 ++++++++++++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/.werks/5318 b/.werks/5318
new file mode 100644
index 0000000..60ea99e
--- /dev/null
+++ b/.werks/5318
@@ -0,0 +1,13 @@
+Title: BI aggregations can be configured to be in multiple groups
+Level: 1
+Component: bi
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1507646464
+
+Previously if more than one group were stated in the
+configuration of any aggregation, the related view displayed
+an error {{Duplicate BI aggregation}}. Fixed that.
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 9fd4177..c722d5f 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -979,7 +979,7 @@ class BIJobManager(object):
time.sleep(0.05)
try:
-
check_title_uniqueness(g_bi_cache_manager.get_compiled_trees()["forest"])
+
check_aggregation_title_uniqueness(g_bi_cache_manager.get_compiled_trees()["aggr_ref"])
except MKConfigError, e:
error_info += str(e)
@@ -1670,6 +1670,8 @@ def compile_forest(user, only_hosts = None, only_groups = None):
def check_title_uniqueness(forest):
+ # Legacy, will be removed any decade from now
+ # One aggregation cannot be in mutliple groups.
known_titles = set()
for group, aggrs in forest.iteritems():
for aggr in aggrs:
@@ -1683,6 +1685,21 @@ def check_title_uniqueness(forest):
else:
known_titles.add(title)
+
+def check_aggregation_title_uniqueness(aggregations):
+ known_titles = set()
+ for attrs in aggregations.values():
+ title = attrs["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)
+
+
# Execute an aggregation rule, but prepare arguments
# and iterate FOREACH first
def compile_rule_node(aggr_type, calllist, lvl):