Module: check_mk
Branch: master
Commit: 25cbc6890e31cbf84f884d210f0b628e70631801
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=25cbc6890e31cb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 25 15:06:48 2016 +0200
3771 FIX Fixed exception on edit rule page in case of special URLs
---
.werks/3771 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/wato/mkeventd.py | 11 +++++++++--
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/.werks/3771 b/.werks/3771
new file mode 100644
index 0000000..ba2b380
--- /dev/null
+++ b/.werks/3771
@@ -0,0 +1,10 @@
+Title: Fixed exception on edit rule page in case of special URLs
+Level: 1
+Component: ec
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1472130399
+
+
diff --git a/ChangeLog b/ChangeLog
index f807724..faa9b37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -632,6 +632,7 @@
* 3566 FIX: Fixed exception on SNMP MIB management page when MIB directory is
missing
* 3568 FIX: Fixed broken link in "Access to event status via TCP" help
text
* 3589 FIX: Fixed processing of RFC 5424 syslog messages
+ * 3771 FIX: Fixed exception on edit rule page in case of special URLs
Livestatus:
* 3644 Fixed 'source' column in 'comments' table.
diff --git a/web/plugins/wato/mkeventd.py b/web/plugins/wato/mkeventd.py
index e9d2093..7a5cf39 100644
--- a/web/plugins/wato/mkeventd.py
+++ b/web/plugins/wato/mkeventd.py
@@ -1463,10 +1463,14 @@ def mode_mkeventd_edit_rule(phase):
if html.has_var("rule_pack"):
rule_pack_nr, rule_pack = rule_pack_with_id(rule_packs,
html.var("rule_pack"))
- # In links from multisite views the rule pack is not known.
- # We just know the rule id and need to find the pack ourselves.
else:
+ # In links from multisite views the rule pack is not known.
+ # We just know the rule id and need to find the pack ourselves.
rule_id = html.var("rule_id")
+ if rule_id == None:
+ raise MKUserError("rule_id", _("The rule you are trying to
edit does not exist."))
+
+ rule_pack = None
for nr, pack in enumerate(rule_packs):
for rnr, rule in enumerate(pack["rules"]):
if rule_id == rule["id"]:
@@ -1476,6 +1480,9 @@ def mode_mkeventd_edit_rule(phase):
html.set_var("rule_pack", pack["id"])
break
+ if not rule_pack:
+ raise MKUserError("rule_id", _("The rule you are trying to
edit does not exist."))
+
rules = rule_pack["rules"]