Module: check_mk
Branch: master
Commit: 49b2842765bfef01ecb9ba77b7b2b82667a70c6a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=49b2842765bfef…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Nov 16 15:35:49 2015 +0100
#2791 FIX Service parameter overview: Fixed problem displaying incorrect rule for
classical checks
The parameter overview did display incorrect links for the <i>"Command
Line"</i> information,
which is shown for classical checks. The command line call at the end of the table,
however, was correct...
This been fixed.
---
.werks/2791 | 12 ++++++++++++
ChangeLog | 1 +
modules/automation.py | 24 +++++++++++++-----------
web/htdocs/wato.py | 12 ++++++++----
4 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/.werks/2791 b/.werks/2791
new file mode 100644
index 0000000..9d2cb3d
--- /dev/null
+++ b/.werks/2791
@@ -0,0 +1,12 @@
+Title: Service parameter overview: Fixed problem displaying incorrect rule for classical
checks
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1447684168
+
+The parameter overview did display incorrect links for the <i>"Command
Line"</i> information,
+which is shown for classical checks. The command line call at the end of the table,
however, was correct...
+This been fixed.
diff --git a/ChangeLog b/ChangeLog
index d9530f7..0150070 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -118,6 +118,7 @@
* 2774 FIX: Fix exception when deleting certain types of MIBs
* 2760 FIX: Fixed case where "activate changes" was not commiting the
pending changes entries correctly...
* 2767 FIX: Fixed broken user list when non unicode mail addresses are loaded
+ * 2791 FIX: Service parameter overview: Fixed problem displaying incorrect rule for
classical checks...
Notifications:
* 2728 FIX: Removed debug notification script (was not executable)...
diff --git a/modules/automation.py b/modules/automation.py
index cac3402..f303302 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -321,17 +321,19 @@ def automation_analyse_service(args):
raise
# 3. Classical checks
- custchecks = host_extra_conf(hostname, custom_checks)
- for nr, entry in enumerate(custchecks):
- desc = entry["service_description"]
- if desc == servicedesc:
- result = {
- "origin" : "classic",
- "rule_nr" : nr,
- }
- if "command_line" in entry: # Only active checks have a command
line
- result["command_line"] = entry["command_line"]
- return result
+ for nr, entry in enumerate(custom_checks):
+ rule, tags, hosts = entry
+ matching_hosts = all_matching_hosts(tags, hosts, with_foreign_hosts = True)
+ if hostname in matching_hosts:
+ desc = rule["service_description"]
+ if desc == servicedesc:
+ result = {
+ "origin" : "classic",
+ "rule_nr" : nr,
+ }
+ if "command_line" in rule: # Only active checks have a command
line
+ result["command_line"] = rule["command_line"]
+ return result
# 4. Active checks
for acttype, rules in active_checks.items():
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2516a8d..4800eeb 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3054,16 +3054,20 @@ def mode_object_parameters(phase):
output_analysed_ruleset(all_rulesets, rulespec, hostname, None,
serviceinfo["parameters"])
elif origin == "classic":
- rule =
all_rulesets["custom_checks"][serviceinfo["rule_nr"]]
+ 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 r in all_rulesets["custom_checks"]:
+ 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 r is rule:
+ if nr == rule_nr:
break
+
url = make_link([('mode', 'edit_ruleset'),
('varname', "custom_checks"), ('host', hostname)])
forms.section('<a href="%s">%s</a>' % (url,
_("Command Line")))
url = make_link([