Package: check-mk-server Version: 1.1.12-1 Severity: minor Tags: patch Hi, In case a precompiled file gets removed but the .py files still exists the generation might get skipped since the unlink fails and throws an exception. Attached patch fixes this. Already sent upstream but since there's no bugtracker I'm unsure if it'll ever get applied. Cheers, -- Guido
-- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (990, 'testing'), (50, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Date: Tue, 17 Apr 2012 10:36:42 +0200 From: Guido =?iso-8859-1?Q?G=FCnther?= <[email protected]> Subject: [PATCH check_mk] Robustify precompiled file generation If the precompiled file gets removed but the .py file still exists then the current code fails to remove the .py file since the first os.remove throws an exception which is being ignored. Therefore the comparision between .py and .py.new is True which results in: foo.exmample.com: mem uptime mrpe cpu (/var/lib/check_mk/precompiled/foo.exmaple.com.py is unchanged) Therefore the precompiled file isn't generated which results in the check_mk failing. So make sure both compiled_file and source_file get removed so the precompiled file gets generatd. --- modules/check_mk.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/check_mk.py b/modules/check_mk.py index 535674d..30f8bc3 100755 --- a/modules/check_mk.py +++ b/modules/check_mk.py @@ -2348,11 +2348,11 @@ def precompile_hostcheck(hostname): compiled_filename = precompiled_hostchecks_dir + "/" + hostname source_filename = compiled_filename + ".py" - try: - os.remove(compiled_filename) - os.remove(source_filename) - except: - pass + for filename in [ compiled_filename, source_filename ]: + try: + os.remove(filename) + except: + pass # check table, enriched with addition precompiled information. check_table = get_precompiled_check_table(hostname) -- 1.7.9.1

