Module: check_mk
Branch: master
Commit: 5b453b687f527878bef6d5f63baf281967a93128
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5b453b687f5278…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 23 10:45:00 2016 +0100
Fixed analyse ruleset of custom checks after recent refactoring
Change-Id: I1511a1dafef3b7147c0eaa48376cbeffe791e231
---
web/htdocs/wato.py | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 22e4ae1..b6f83da 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2234,33 +2234,23 @@ def mode_object_parameters(phase):
elif origin == "classic":
rule_nr = serviceinfo["rule_nr"]
- rule = all_rulesets["custom_checks"][rule_nr]
-
- # Find relative rule number in folder
- old_folder = None
- rel_nr = -1
- for nr, r in enumerate(all_rulesets["custom_checks"]):
- if old_folder != r[0]:
- old_folder = r[0]
- rel_nr = -1
- rel_nr += 1
- if nr == rule_nr:
- break
+ rules = all_rulesets.get("custom_checks").get_rules()
+ rule_folder, rule_index, rule = rules[rule_nr]
url = folder_preserving_link([('mode', 'edit_ruleset'),
('varname', "custom_checks"), ('host', hostname)])
forms.section('<a href="%s">%s</a>' % (url,
_("Command Line")))
url = folder_preserving_link([
('mode', 'edit_rule'),
('varname', "custom_checks"),
- ('rule_folder', rule[0].path()),
- ('rulenr', rel_nr),
+ ('rule_folder', rule_folder.path()),
+ ('rulenr', rule_index),
('host', hostname)])
html.open_table(class_="setting")
html.open_tr()
html.open_td(class_="reason")
- html.a("%s %d %s %s" % (_("Rule"), rel_nr + 1,
_("in"), rule[0].title()), href=url)
+ html.a("%s %d %s %s" % (_("Rule"), rule_index + 1,
_("in"), rule_folder.title()), href=url)
html.close_td()
html.open_td(class_=["settingvalue", "used"])
if "command_line" in serviceinfo: