Module: check_mk
Branch: master
Commit: bd7617fbe9cc12b75cfcac92abee4ed11698285e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bd7617fbe9cc12…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jun 26 08:40:54 2015 +0200
#2344 FIX Improved validation of selected rules when editing BI aggregations
In previous versions it was possible to create a non working BI configuration
using the BI editor by creating an aggregation which calls a BI rules which
needs one or several arguments, but not providing any argument in the BI aggregation.
Saving this configuration was possible and caused problems in different places
of the GUI, for example the report editor when rendering the BI filters.
The editor has been extended to do a better validation to prevent this kind of
misconfiguration.
---
.werks/2344 | 17 +++++++++++++++++
ChangeLog | 3 +++
web/htdocs/wato.py | 15 ++++++++++++++-
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/.werks/2344 b/.werks/2344
new file mode 100644
index 0000000..1ac61d3
--- /dev/null
+++ b/.werks/2344
@@ -0,0 +1,17 @@
+Title: Improved validation of selected rules when editing BI aggregations
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1435300730
+
+In previous versions it was possible to create a non working BI configuration
+using the BI editor by creating an aggregation which calls a BI rules which
+needs one or several arguments, but not providing any argument in the BI aggregation.
+Saving this configuration was possible and caused problems in different places
+of the GUI, for example the report editor when rendering the BI filters.
+
+The editor has been extended to do a better validation to prevent this kind of
+misconfiguration.
diff --git a/ChangeLog b/ChangeLog
index 79d1fb3..129bb11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@
Multisite:
* 2314 FIX: Availability: fixed exception when grouping by host or service group
+ WATO:
+ * 2344 FIX: Improved validation of selected rules when editing BI aggregations...
+
Notifications:
* 2313 FIX: notification bulking: fixed exception for plugins which are not
configured with checkboxes, e.g. sms
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f3736fe..c7a256d 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -16980,6 +16980,18 @@ def convert_aggregation_to_bi(aggr):
convaggr = (bi_constants["DISABLED"],) + convaggr
return convaggr
+
+def validate_bi_rule_call(value, varprefix):
+ rule_id, arguments = value
+ aggregations, aggregation_rules = load_bi_rules()
+ rule_params = aggregation_rules[rule_id]['params']
+
+ if len(arguments) != len(rule_params):
+ raise MKUserError(varprefix+"_1_0", _("The rule you selected needs
%d argument(s) (%s), "
+ "but you configured %d arguments.") %
+ (len(rule_params), ', '.join(rule_params),
len(arguments)))
+
+
# Not in global context, so that l10n will happen again
def declare_bi_valuespecs(aggregation_rules):
global vs_aggregation, aggregation_choices, vs_bi_node
@@ -17002,7 +17014,8 @@ def declare_bi_valuespecs(aggregation_rules):
size = 12,
title = _("Arguments:"),
),
- ]
+ ],
+ validate = validate_bi_rule_call,
)
host_re_help = _("Either an exact host name or a regular expression exactly
matching the host "