Module: check_mk
Branch: master
Commit: 3914084b81e990903423ad781956d85b05140785
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3914084b81e990…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 27 09:41:31 2017 +0100
4401 FIX Improved error handling in case of invalid autocheck entries
Change-Id: Ic2d4a69b1e1e9f3d8a3f77d4d8c840edccbfc87a
---
.werks/4401 | 11 +++++++++++
modules/discovery.py | 6 ++++++
2 files changed, 17 insertions(+)
diff --git a/.werks/4401 b/.werks/4401
new file mode 100644
index 0000000..b5966d5
--- /dev/null
+++ b/.werks/4401
@@ -0,0 +1,11 @@
+Title: Improved error handling in case of invalid autocheck entries
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1488184872
+
+
diff --git a/modules/discovery.py b/modules/discovery.py
index 9bad839..5af117b 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -1251,10 +1251,16 @@ def read_autochecks_of(hostname, world="config"):
if len(entry) == 4: # old format where hostname is at the first place
entry = entry[1:]
check_type, item, parameters = entry
+
# With Check_MK 1.2.7i3 items are now defined to be unicode strings. Convert
# items from existing autocheck files for compatibility. TODO remove this one
day
if type(item) == str:
item = decode_incoming_string(item)
+
+ if type(check_type) not in (str, unicode):
+ raise MKGeneralException("Invalid entry '%r' in check table of
host '%s': "
+ "The check type must be a string." %
(entry, hostname))
+
autochecks.append((check_type, item, compute_check_parameters(hostname,
check_type, item, parameters)))
return autochecks