Module: check_mk
Branch: master
Commit: 8351da9240f5ca09c5ce8d80aa431d15cc12f936
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8351da9240f5ca…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Sep 18 13:15:43 2013 +0200
Avoid race condition with intermediate DNS cache
---
modules/check_mk.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 7267c4e..d911cd9 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1196,7 +1196,9 @@ def init_ip_lookup_cache():
g_ip_lookup_cache = {}
def write_ip_lookup_cache():
- file(var_dir + '/ipaddresses.cache',
'w').write(repr(g_ip_lookup_cache))
+ suffix = "." + str(os.getpid())
+ file(var_dir + '/ipaddresses.cache' + suffix,
'w').write(repr(g_ip_lookup_cache))
+ os.rename(var_dir + '/ipaddresses.cache' + suffix, var_dir +
'/ipaddresses.cache')
def do_update_dns_cache():
# Temporarily disable *use* of cache, we want to force an update