Module: check_mk
Branch: master
Commit: 42025d1b22a2a057ec08b9ad0d99e2d0b94b6a0a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42025d1b22a2a0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Feb 9 19:01:24 2013 +0100
WATO BI: check for cycles in rules
---
web/htdocs/wato.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 8605019..1098366 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11919,7 +11919,7 @@ def mode_bi_edit_rule(phase):
if phase == "action":
if html.check_transaction():
new_rule = vs_rule.from_html_vars('rule')
- vs_main.validate_value(new_rule, 'rule')
+ vs_rule.validate_value(new_rule, 'rule')
if new:
ruleid = new_rule["id"]
@@ -11932,6 +11932,10 @@ def mode_bi_edit_rule(phase):
log_audit(None, "bi-new-rule", _("Create new BI rule
%s") % ruleid)
else:
aggregation_rules[ruleid].update(new_rule)
+ new_rule["id"] = ruleid
+ if bi_rule_uses_rule(aggregation_rules, new_rule,
new_rule["id"]):
+ raise MKUserError(None, _("There is a cycle in your rules. This
rule calls itself - "
+ "either directly or
indirectly."))
log_audit(None, "bi-edit-rule", _("Modified BI rule
%s") % ruleid)
save_bi_rules(aggregations, aggregation_rules)
@@ -11954,9 +11958,6 @@ def mode_bi_edit_rule(phase):
html.end_form()
# TODO BI:
-# - Prüfung auf Zyklen in den Regeln. Bzw. die Auswahlbox
-# darf nur Regeln zeigen, die die aktuelle Regel nicht
-# brauchen.
# - Host Tags richtig editieren, nicht mit ListOfStrings.
# Dazu ein ValueSpec machen und dies dann auch im Regel-
# editor verwenden.