Module: check_mk
Branch: master
Commit: 33cf88df3c7e2b11aba648ab7bd88739536dc74a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=33cf88df3c7e2b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 2 08:35:33 2017 +0200
5217 FIX BI: Improved error handling in case of not existing but referenced rule
The error handling has been improved for the situation where an aggregation
references a not existing BI rule.
Change-Id: I1e3978fd559c65dc32ba0d97a898d885a2cf595e
---
.werks/5217 | 12 ++++++++++++
web/plugins/wato/bi.py | 7 +++++++
2 files changed, 19 insertions(+)
diff --git a/.werks/5217 b/.werks/5217
new file mode 100644
index 0000000..10cddb8
--- /dev/null
+++ b/.werks/5217
@@ -0,0 +1,12 @@
+Title: BI: Improved error handling in case of not existing but referenced rule
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1506926056
+
+The error handling has been improved for the situation where an aggregation
+references a not existing BI rule.
diff --git a/web/plugins/wato/bi.py b/web/plugins/wato/bi.py
index ad907a9..e2e046b 100644
--- a/web/plugins/wato/bi.py
+++ b/web/plugins/wato/bi.py
@@ -1066,6 +1066,9 @@ class ModeBIAggregations(ModeBI):
def render_aggregation_rule_tree(self, aggregation):
toplevel_rule = self.aggregation_toplevel_rule(aggregation)
+ if not toplevel_rule:
+ html.show_error(_("The top level rule does not exist."))
+ return
self.render_rule_tree(toplevel_rule["id"],
toplevel_rule["id"])
@@ -1318,9 +1321,13 @@ class ModeBIRules(ModeBI):
def _aggregation_recursive_sub_rule_ids(self, ruleid):
rule = self.find_rule_by_id(ruleid)
+ if not rule:
+ return []
+
sub_rule_ids = self.aggregation_sub_rule_ids(rule)
if not sub_rule_ids:
return []
+
result = sub_rule_ids[:]
for sub_rule_id in sub_rule_ids:
result += self._aggregation_recursive_sub_rule_ids(sub_rule_id)