Module: check_mk
Branch: master
Commit: 5907b1aa4ef82ceceb6f6111bd19433a9a524102
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5907b1aa4ef82c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 22 14:51:46 2018 +0100
5868 FIX Fix duplicate search entries in check plugins search in WATO
Some check plugins are listed in several paths in the catalog of man pages
(e.g. <tt>nfsmount</tt>). These would be listed twice in the search results
of the WATO module {{Check plugins}}. This has been fixed.
---
.werks/5868 | 12 ++++++++++++
web/htdocs/wato.py | 12 +++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/.werks/5868 b/.werks/5868
new file mode 100644
index 0000000..b465206
--- /dev/null
+++ b/.werks/5868
@@ -0,0 +1,12 @@
+Title: Fix duplicate search entries in check plugins search in WATO
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1519307412
+Class: fix
+
+Some check plugins are listed in several paths in the catalog of man pages
+(e.g. <tt>nfsmount</tt>). These would be listed twice in the search results
+of the WATO module {{Check plugins}}. This has been fixed.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2d81fe9..13a0cd9 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15741,6 +15741,7 @@ class ModeCheckPlugins(WatoMode):
def _get_manpages_after_search(self):
collection = {}
+ handled_check_names = set([])
# searches in {"name" : "asd", "title" :
"das", ...}
def get_matched_entry( entry ):
@@ -15767,7 +15768,16 @@ class ModeCheckPlugins(WatoMode):
if these_matches:
collection.setdefault( key, [] )
- collection[key] += these_matches
+ # avoid duplicates due to the fact that a man page can have more
than
+ # one places in the global tree of man pages.
+ for match in these_matches:
+ name = match.get("name")
+ if name and name in handled_check_names:
+ continue # avoid duplicate
+ else:
+ collection[key].append(match)
+ if name:
+ handled_check_names.add(name)
elif type(entries) == dict:
for key, subentries in entries.items():