Module: check_mk
Branch: master
Commit: 1bd2ad913d2e4e1f465fe4b737e9f362424951a2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1bd2ad913d2e4e…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Thu Oct 25 14:48:50 2018 +0200
Fix discover API, use without parameters
Change-Id: Ie96513d91a3790fd17e22d06e9ed1bd035312891
---
cmk_base/check_api.py | 3 +++
tests/unit/cmk_base/test_check_api.py | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/cmk_base/check_api.py b/cmk_base/check_api.py
index a24215a..da68a34 100644
--- a/cmk_base/check_api.py
+++ b/cmk_base/check_api.py
@@ -642,6 +642,9 @@ def discover(selector=None, default_params=None):
if callable(selector):
return _discovery(selector)
+ if selector is None and default_params is None:
+ return _discovery(lambda *args: args[0])
+
return _discovery
diff --git a/tests/unit/cmk_base/test_check_api.py
b/tests/unit/cmk_base/test_check_api.py
index 534314b..b8eac78 100644
--- a/tests/unit/cmk_base/test_check_api.py
+++ b/tests/unit/cmk_base/test_check_api.py
@@ -56,6 +56,10 @@ def test_discover_single(parsed, result):
({
"one": None,
"two": None,
+ }, None, [("one", {}), ("two", {})]),
+ ({
+ "one": None,
+ "two": None,
}, lambda k, v: k, [("one", {}), ("two", {})]),
({
"one": None,