Module: check_mk
Branch: master
Commit: 08fde23dcd28084677857dc90eaa2cbef6851b3f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=08fde23dcd2808…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 6 11:35:29 2016 +0200
3324 FIX Do not crash whole catalog of check plugins if one man page is broken
---
.werks/3324 | 10 ++++++++++
ChangeLog | 1 +
modules/check_mk.py | 16 ++++++++++++++--
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/.werks/3324 b/.werks/3324
new file mode 100644
index 0000000..2846fc0
--- /dev/null
+++ b/.werks/3324
@@ -0,0 +1,10 @@
+Title: Do not crash whole catalog of check plugins if one man page is broken
+Level: 2
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459935309
+
+
diff --git a/ChangeLog b/ChangeLog
index 77563e8..8c68020 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -219,6 +219,7 @@
* 3361 FIX: Event Console files not synced to remote site nor backed up with WATO
snapshot
* 3362 FIX: Fixed reload of Event Console in distributed monitoring slave site
* 3363 FIX: Exceptions in WATO Web-API are now rendered as plain text messages
+ * 3324 FIX: Do not crash whole catalog of check plugins if one man page is broken
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index b3e4e92..9e5df42 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2482,8 +2482,7 @@ def read_manpage_catalog():
except Exception, e:
if opt_debug:
raise
- raise MKGeneralException('ERROR: Skipping invalid manpage: %s: %s\n'
% (checkname, e))
- continue
+ parsed = create_fallback_manpage(checkname, path, e)
if "catalog" in parsed:
cat = parsed["catalog"]
@@ -2587,6 +2586,19 @@ def dialog_menu(title, text, choices, defvalue, oktext,
canceltext):
return run_dialog(args)
+def create_fallback_manpage(checkname, path, error_message):
+ return {
+ "name" : checkname,
+ "path" : path,
+ "description" : file(path).read().strip(),
+ "title" : "%s: Cannot parse man page: %s" %
(checkname, error_message),
+ "agents" : "",
+ "license" : "unknown",
+ "distribution" : "unknown",
+ "catalog" : [ "generic" ],
+ }
+
+
def parse_man_header(checkname, path):
parsed = {}
parsed["name"] = checkname