Write new file to a temporary and move it afterwards.
This commit is contained in:
parent
53d8f4bcf2
commit
33d7b3aefc
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue