Write new file to a temporary and move it afterwards.

This commit is contained in:
Daniel Ehlers 2014-01-01 18:59:33 +01:00
parent 53d8f4bcf2
commit 33d7b3aefc

View file

@ -67,6 +67,10 @@ rrd.update_images()
m = D3MapBuilder(db)
nodes_json = open(options['destination_directory'] + '/nodes.json','w')
#Write nodes json
nodes_json = open(options['destination_directory'] + '/nodes.json.new','w')
nodes_json.write(m.build())
nodes_json.close()
#Move to destination
os.rename(options['destination_directory'] + '/nodes.json.new',options['destination_directory'] + '/nodes.json')