Create tmpfile in the same dir as the cache file
Make sure we don't try to rename files across devices. Fixes bug 949366 Change-Id: I75581a0682c8db90cad9b077b1c22a886d234e31
This commit is contained in:
parent
ad6684a00f
commit
f1290e8080
@ -1099,7 +1099,8 @@ def dump_recon_cache(cache_key, cache_value, cache_file, lock_timeout=2):
|
||||
pass
|
||||
cache_entry[cache_key] = cache_value
|
||||
try:
|
||||
with NamedTemporaryFile(delete=False) as tf:
|
||||
with NamedTemporaryFile(dir=os.path.dirname(cache_file),
|
||||
delete=False) as tf:
|
||||
tf.write(json.dumps(cache_entry) + '\n')
|
||||
os.rename(tf.name, cache_file)
|
||||
finally:
|
||||
|
Loading…
x
Reference in New Issue
Block a user