Module: check_mk
Branch: master
Commit: 5d8db5efe355e7677c799172b6d853c564a3e155
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5d8db5efe355e7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jun 29 14:47:59 2015 +0200
#2380 FIX Custom Host Notes painter was showing service notes when used in service based
views
---
.werks/2380 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/views/painters.py | 8 ++++----
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/.werks/2380 b/.werks/2380
new file mode 100644
index 0000000..9aa2bfa
--- /dev/null
+++ b/.werks/2380
@@ -0,0 +1,10 @@
+Title: Custom Host Notes painter was showing service notes when used in service based
views
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1435582050
+
+
diff --git a/ChangeLog b/ChangeLog
index c8860ee..654e4fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* 2314 FIX: Availability: fixed exception when grouping by host or service group
* 2361 FIX: Fix exception for missing key 'title' in certain cases of older
customized views
* 2379 FIX: Plugin-Output: Fixed handling of URLs within output of check_http...
+ * 2380 FIX: Custom Host Notes painter was showing service notes when used in service
based views
WATO:
* 2365 Removed old deprecated notification global options for plain emails...
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 8f0b8f8..1c93061 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -984,10 +984,10 @@ def notes_matching_pattern_entries(dirs, item):
matching.append(dir + "/" + pattern)
return matching
-def paint_custom_notes(row):
+def paint_custom_notes(what, row):
host = row["host_name"]
svc = row.get("service_description")
- if svc:
+ if what == "service":
notes_dir = defaults.default_config_dir + "/notes/services"
dirs = notes_matching_pattern_entries([notes_dir], host)
item = svc
@@ -1022,7 +1022,7 @@ multisite_painters["svc_custom_notes"] = {
"title" : _("Custom services notes"),
"short" : _("Notes"),
"columns" : [ "host_name", "host_address",
"service_description", "service_plugin_output" ],
- "paint" : paint_custom_notes,
+ "paint" : lambda row: paint_custom_notes("service", row),
}
multisite_painters["svc_staleness"] = {
@@ -1490,7 +1490,7 @@ multisite_painters["host_custom_notes"] = {
"title" : _("Custom host notes"),
"short" : _("Notes"),
"columns" : [ "host_name", "host_address",
"host_plugin_output" ],
- "paint" : paint_custom_notes,
+ "paint" : lambda row: paint_custom_notes("hosts", row),
}
multisite_painters["host_comments"] = {