Module: check_mk
Branch: master
Commit: 7fbcd746b446cb3776808aab8e9e70fd1e39aacf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7fbcd746b446cb…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Feb 27 12:45:13 2011 +0100
FIX: precompile: include files before checks
---
ChangeLog | 2 ++
modules/check_mk.py | 22 +++++++++++++---------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index decec2f..94d9768 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
Core, Setup, etc.:
* FIX: do not assume 127.0.0.1 as IP address for usewalk_hosts if
they are not SNMP hosts.
+ * FIX: precompile: make sure check includes are added before actual
+ checks
Checks & Agents:
* FIX: drbd now handles output of older version without an ep field
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 6685637..51ececb 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2015,20 +2015,25 @@ no_inventory_possible = None
# check info table
# We need to include all those plugins that are referenced in the host's
# check table
- filenames = set([])
+ filenames = []
for checktype in needed_types:
+ # Add library files needed by check (also look in local)
+ for lib in check_includes.get(checktype, []):
+ if local_checks_dir and os.path.exists(local_checks_dir + "/" +
lib):
+ to_add = local_checks_dir + "/" + lib
+ else:
+ to_add = checks_dir + "/" + lib
+ if to_add not in filenames:
+ filenames.append(to_add)
+
+ # Now add check file itself
path = find_check_plugin(checktype)
if not path:
raise MKGeneralException("Cannot find plugin for check type %s (missing
file %s/%s)\n" % \
(checktype, checks_dir, checktype))
- filenames.add(path)
+ if path not in filenames:
+ filenames.append(path)
- # Add library files needed by check (also look in local)
- for lib in check_includes.get(checktype, []):
- if local_checks_dir and os.path.exists(local_checks_dir + "/" +
lib):
- filenames.add(local_checks_dir + "/" + lib)
- else:
- filenames.add(checks_dir + "/" + lib)
output.write("check_info = {}\n" +
"check_includes = {}\n" +
@@ -2038,7 +2043,6 @@ no_inventory_possible = None
"snmp_info_single = {}\n" +
"snmp_scan_functions = {}\n")
-
for filename in filenames:
output.write("# %s\n" % filename)
output.write(stripped_python_file(filename))