Module: check_mk
Branch: master
Commit: 5012cd62d45d4dd9b64459cc8c070b482be90f4e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5012cd62d45d4d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Apr 18 16:55:17 2018 +0200
5801 FIX Fixed incorrect check parameter assignment after tabula rasa
The tabula rasa discovery could assign incorrect default parameters to the discovered
service.
Generally, if multiple rules provide check parameters, the most specific rule should win.
For ps checks the least specific rule did win. This has been fixed.
Change-Id: Id945afe730b6d3b9104945655fbf55e988f6452c
---
.werks/5801 | 13 +++++++++++++
cmk_base/discovery.py | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/5801 b/.werks/5801
new file mode 100644
index 0000000..430e810
--- /dev/null
+++ b/.werks/5801
@@ -0,0 +1,13 @@
+Title: Fixed incorrect check parameter assignment after tabula rasa
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524062928
+
+The tabula rasa discovery could assign incorrect default parameters to the discovered
service.
+Generally, if multiple rules provide check parameters, the most specific rule should
win.
+For ps checks the least specific rule did win. This has been fixed.
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index 882849a..fcaf2a9 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -979,7 +979,7 @@ def _get_discovered_services(hostname, ipaddress, sources,
multi_host_sections,
# Handle discovered services -> "new"
new_items = _discover_services(hostname, ipaddress, sources, multi_host_sections,
on_error)
for check_plugin_name, item, paramstring in new_items:
- services[(check_plugin_name, item)] = ("new", paramstring)
+ services.setdefault((check_plugin_name, item), ("new", paramstring))
# Match with existing items -> "old" and "vanished"
old_items = parse_autochecks_file(hostname)