Module: check_mk
Branch: master
Commit: 969eaa5f0094b4d3eacf15224224f96e4a93649b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=969eaa5f0094b4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Feb 26 12:28:32 2016 +0100
#3248 FIX Avoid broken list of context filters and case of a BI error
---
.werks/3248 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/bi.py | 10 +++++-----
web/htdocs/visuals.py | 9 ++++++++-
4 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/.werks/3248 b/.werks/3248
new file mode 100644
index 0000000..2bd67df
--- /dev/null
+++ b/.werks/3248
@@ -0,0 +1,10 @@
+Title: Avoid broken list of context filters and case of a BI error
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456486084
+
+
diff --git a/ChangeLog b/ChangeLog
index 339165b..06d9c2d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -54,6 +54,7 @@
* 3076 FIX: fixed broken views in check_mk raw edition
* 3077 FIX: CSV export is now available for host/service availability and now
includes summary line
* 3181 FIX: Omit icon for downloading agent output on shadow hosts (cmcdump)...
+ * 3248 FIX: Avoid broken list of context filters and case of a BI error
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index d6033a2..c4d32c1 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -720,23 +720,23 @@ def compile_aggregation_rule(aggr_type, rule, args, lvl):
)
if len(rule) != 4:
- raise MKConfigError(_("<b>Invalid aggregation
rule</b><br><br>"
+ raise MKConfigError(_("<b>Invalid BI aggregation rule</b>:
"
"Aggregation rules must contain four elements: description, argument
list, "
"aggregation function and list of nodes. Your rule has %d elements:
"
"<pre>%s</pre>") % (len(rule),
pprint.pformat(rule)))
if lvl == 50:
- raise MKConfigError(_("<b>Depth limit
reached</b><br><br>"
+ raise MKConfigError(_("<b>BI depth limit reached</b>: "
"The nesting level of aggregations is limited to 50. You either
configured "
- "too many levels or built an infinite recursion. This happened in
rule <pre>%s</pre>")
+ "too many levels or built an infinite recursion. This happened in
rule %s")
% pprint.pformat(rule))
description, arglist, funcname, nodes = rule
# check arguments and convert into dictionary
if len(arglist) != len(args):
- raise MKConfigError(_("<b>Invalid rule
usage</b><br><br>"
- "The rule '%s' needs %d arguments:
<tt>%s</tt><br>"
+ raise MKConfigError(_("<b>Invalid BI rule usage</b>: "
+ "The rule '%s' needs %d arguments: <tt>%s</tt>.
"
"You've specified %d arguments: <tt>%s</tt>") %
(
description, len(arglist), repr(arglist), len(args), repr(args)))
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 2b0c763..4a85a30 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -821,7 +821,14 @@ def show_filter(f):
html.write('<div class="floatfilter %s">' %
(f.double_height() and "double" or "single"))
html.write('<div class=legend>%s</div>' %
html.attrencode(f.title))
html.write('<div class=content>')
- f.display()
+ try:
+ f.display()
+ except Exception, e:
+ if config.debug:
+ raise
+ html.icon(_("This filter cannot be displayed"), "alert")
+ html.write("%s" % e)
+
html.write("</div>")
html.write("</div>")