Module: check_mk
Branch: master
Commit: 85a6e062eda020f3e61e55fec55790c330840dab
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=85a6e062eda020…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 9 14:24:48 2017 +0200
4670 FIX Fixed exception when trying to edit not existing BI aggregation
Change-Id: I0e4faedadccd2d6f5381727010c197b35699b68b
---
.werks/4670 | 11 +++++++++++
web/plugins/wato/bi.py | 8 +++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/.werks/4670 b/.werks/4670
new file mode 100644
index 0000000..e090f46
--- /dev/null
+++ b/.werks/4670
@@ -0,0 +1,11 @@
+Title: Fixed exception when trying to edit not existing BI aggregation
+Level: 1
+Component: bi
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1494332654
+
+
diff --git a/web/plugins/wato/bi.py b/web/plugins/wato/bi.py
index edefa22..895f370 100644
--- a/web/plugins/wato/bi.py
+++ b/web/plugins/wato/bi.py
@@ -72,7 +72,7 @@ class ModeBI(WatoMode):
if html.has_var("pack"):
self._pack_id = html.var("pack")
if self._pack_id not in self._packs:
- raise MKGeneralException(_("Invalid URL. BI pack %s does not
exist.") % html.attrencode(self._pack_id))
+ raise MKGeneralException(_("The BI pack '%s' does not
exist.") % html.attrencode(self._pack_id))
self._pack = self._packs[self._pack_id]
else:
self._pack_id = None
@@ -1284,8 +1284,10 @@ class ModeBIEditAggregation(ModeBI):
self._edited_aggregation = { "groups" : [ _("Main") ] }
else:
self._new = False
- self._edited_aggregation =
self._pack["aggregations"][self._edited_nr]
-
+ try:
+ self._edited_aggregation =
self._pack["aggregations"][self._edited_nr]
+ except IndexError:
+ raise MKUserError("id", _("This aggregation does not
exist."))
def title(self):