Commit ec5cf9f3 authored by Daniel Salzman's avatar Daniel Salzman

sql import: update zone file atomically

parent 27bc7cf4
......@@ -168,10 +168,13 @@ def print_domain(domain, change_type = 0, txn = None):
global slave_mode
dn = domain_id2name(domain, txn) if str(domain).isdigit() else domain
if not slave_mode:
f = open(zone_storage(dn), "w")
file_name = zone_storage(dn)
tmp_name = "%s.tmp" % file_name
f = open(tmp_name, "w")
for r in domain_get_records(domain, txn):
print_record(r, f)
os.rename(tmp_name, file_name)
if knotc_socket is not None:
knotc_send(change_type, dn)
print("Updated zone %s" % dn)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment