Module: check_mk
Branch: master
Commit: 490526e1aef0e81a9ee25e4a7e89f9ec98afe79f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=490526e1aef0e8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 9 14:28:15 2017 +0200
BI: Fixed exception when trying to edit/clone not existing BI rule
Change-Id: I033c229a4d9ce92e868621e2c4173802076bc606
---
web/plugins/wato/bi.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/web/plugins/wato/bi.py b/web/plugins/wato/bi.py
index 895f370..5db13df 100644
--- a/web/plugins/wato/bi.py
+++ b/web/plugins/wato/bi.py
@@ -1431,11 +1431,17 @@ class ModeBIEditRule(ModeBI):
if self._new:
cloneid = html.var("clone")
if cloneid:
- value = self._pack["rules"][cloneid]
+ try:
+ value = self._pack["rules"][cloneid]
+ except KeyError:
+ raise MKGeneralException(_("This BI rule does not exist"))
else:
value = {}
else:
- value = self._pack["rules"][self._ruleid]
+ try:
+ value = self._pack["rules"][self._ruleid]
+ except KeyError:
+ raise MKGeneralException(_("This BI rule does not exist"))
html.begin_form("birule", method="POST")
self.valuespec().render_input("rule", value)