Module: check_mk
Branch: master
Commit: 718c22a90aeea9e8ad09ef2b1c456760145efa41
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=718c22a90aeea9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 15 12:00:15 2016 +0100
3291 FIX Improved error handling when searching for BI aggregations with invalid regex
---
.werks/3291 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/visuals/bi.py | 7 ++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/3291 b/.werks/3291
new file mode 100644
index 0000000..69582c9
--- /dev/null
+++ b/.werks/3291
@@ -0,0 +1,10 @@
+Title: Improved error handling when searching for BI aggregations with invalid regex
+Level: 1
+Component: bi
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1458039590
+
+
diff --git a/ChangeLog b/ChangeLog
index 998860d..8d9191a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -139,6 +139,7 @@
BI:
* 3247 FIX: Do not allow multiple BI aggregates with the same title...
* 3232 FIX: BI: Only querying site of host for specific host status info...
+ * 3291 FIX: Improved error handling when searching for BI aggregations with invalid
regex
Reporting & Availability:
* 3267 New availability option for reclassifying host state
"unreachable"...
diff --git a/web/plugins/visuals/bi.py b/web/plugins/visuals/bi.py
index cd4ac8d..b2e5ed0 100644
--- a/web/plugins/visuals/bi.py
+++ b/web/plugins/visuals/bi.py
@@ -82,7 +82,12 @@ class BITextFilter(Filter):
if not val:
return rows
if self.how == "regex":
- reg = re.compile(val.lower())
+ try:
+ reg = re.compile(val.lower())
+ except re.error, e:
+ html.add_user_error(None, "Invalid regular expression: %s" %
e)
+ return rows
+
return [ row for row in rows if reg.search(row[self.column].lower()) ]
else:
return [ row for row in rows if row[self.column] == val ]