Module: check_mk
Branch: master
Commit: 3c78b0242f1a7867c11da16073991f86940d72be
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3c78b0242f1a78…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 25 11:48:53 2012 +0100
WATO: fix error message when creation of rules fail
for example if no selection elements are available
---
web/htdocs/wato.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a7a229a..5a0bbc0 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -10265,7 +10265,12 @@ def mode_edit_rule(phase, new = False):
if html.has_var("_new_host_rule"):
host = html.var("host")
item = html.has_var("item") and mk_eval(html.var("item"))
or NO_ITEM
- rule = create_rule(rulespec, host, item)
+ try:
+ rule = create_rule(rulespec, host, item)
+ except Exception, e:
+ if phase != "action":
+ html.message(_("Cannot create rule: %s") % e)
+ return
rulenr = len(rules)
else:
rulenr = int(html.var("rulenr"))