Module: check_mk
Branch: master
Commit: 3df72238704a69863d60eb01496aad399f2306ea
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3df72238704a69…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 22 16:20:01 2013 +0100
FIX: more robust deletion of precompiled files to ensure the correct creation of the files
(Thanks to Guido Günther)
---
ChangeLog | 2 ++
modules/check_mk.py | 10 +++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d2d0f0b..1c74438 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
* cmk --notify: added the macros NOTIFY_LASTHOSTSTATECHANGE, NOTIFY_HOSTSTATEID,
NOTIFY_LASTSERVICESTATECHANGE, NOTIFY_SERVICESTATEID, NOTIFY_NOTIFICATIONCOMMENT,
NOTIFY_NOTIFICATIONAUTHOR, NOTIFY_NOTIFICATIONAUTHORNAME,
NOTIFY_NOTIFICATIONAUTHORALIAS
+ * FIX: more robust deletion of precompiled files to ensure the correct
+ creation of the files (Thanks to Guido Günther)
Checks & Agents:
diff --git a/modules/check_mk.py b/modules/check_mk.py
index bfe2d7b..0bbec6e 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2588,11 +2588,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 fname in [ compiled_filename, source_filename ]:
+ try:
+ os.remove(fname)
+ except:
+ pass
# check table, enriched with addition precompiled information.
check_table = get_precompiled_check_table(hostname)