Module: check_mk
Branch: master
Commit: 943a1d9dc0f40c1b0f19df5c5ff190b470fa390b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=943a1d9dc0f40c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 17 16:59:45 2014 +0100
#1790 FIX Fix WATO parameters page for passive checks
Showing the parameters page for passive checks (i.e. classical checks without
a command line) resulted in an exception. This has been fixed.
---
.werks/1790 | 11 +++++++++++
ChangeLog | 1 +
modules/automation.py | 6 ++++--
web/htdocs/wato.py | 11 +++++++----
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/.werks/1790 b/.werks/1790
new file mode 100644
index 0000000..f0d1fc6
--- /dev/null
+++ b/.werks/1790
@@ -0,0 +1,11 @@
+Title: Fix WATO parameters page for passive checks
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418831944
+
+Showing the parameters page for passive checks (i.e. classical checks without
+a command line) resulted in an exception. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index 9a3dfb4..a3e35f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@
* 1761 FIX: Ruleset search is now consistent for host & serviceparameters and
manual checks
* 1765 FIX: Fixed bug when generating nagvis backends while having sites with
livestatus proxy configured...
* 1789 FIX: Fix preview of passive checks in WATO list of services
+ * 1790 FIX: Fix WATO parameters page for passive checks...
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host
notications
diff --git a/modules/automation.py b/modules/automation.py
index 3eb7774..3e8da31 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -599,11 +599,13 @@ def automation_analyse_service(args):
for nr, entry in enumerate(custchecks):
desc = entry["service_description"]
if desc == servicedesc:
- return {
+ result = {
"origin" : "classic",
"rule_nr" : nr,
- "command_line" : entry["command_line"],
}
+ if "command_line" in entry: # Only active checks have a command
line
+ result["command_line"] = entry["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 4ab56f1..cea3a10 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2651,9 +2651,12 @@ def mode_object_parameters(phase):
html.write('<table class=setting><tr><td
class=reason><a href="%s">%s %d %s %s</a></td>' % (
url, _("Rule"), rel_nr + 1, _("in"),
rule[0]["title"]))
- html.write("<td class=settingvalue
used><tt>%s</tt></td></tr></table>" %
- serviceinfo["command_line"])
-
+ html.write("<td class=settingvalue used>")
+ if "command_line" in serviceinfo:
+ html.write("<tt>%s</tt>" %
serviceinfo["command_line"])
+ else:
+ html.write(_("(no command line, passive check)"))
+ html.write("</td></tr></table>")
last_maingroup = None
for groupname in groupnames:
@@ -5403,7 +5406,7 @@ def check_mk_local_automation(command, args=[],
indata=""):
raise MKGeneralException("Error running <tt>%s</tt> (exit
code %d): <pre>%s</pre>%s" %
(" ".join(cmd), exitcode, hilite_errors(outdata),
outdata.lstrip().startswith('sudo:') and sudo_msg or ''))
else:
- raise MKGeneralException("<h1>%s</h1>%s" %
(_("Error"), hilite_errors(outdata)))
+ raise MKGeneralException(hilite_errors(outdata))
# On successful "restart" command execute the activate changes hook