Your message dated Fri, 06 Nov 2015 14:31:04 -0800
with message-id <[email protected]>
and subject line Re: [Bug]: cleanup precompile files
has caused the Debian Bug report #669357,
regarding Precompiling files might get skipped if unlinking them fails
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
669357: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=669357
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
Mathias Kettner writes:
> Hi Matt,
> 
> seem like the patch is already included meanwhile. Right?

Ah yes! Looks like it was closed with this commit:

committer       Lars Michelsen <[email protected]>        
        Tue, 22 Jan 2013 15:20:01 +0000 (16:20 +0100)
commit  3df72238704a69863d60eb01496aad399f2306ea
FIX: more robust deletion of precompiled files to ensure the correct
  creation of the files (Thanks to Guido Günther)

I should have checked the tree, sorry for the noise.
Closing this bug.

Thanks,

-- 
Matt Taggart
[email protected]

--- End Message ---

Reply via email to