samba_dnsupdate: flush dns update cache file after write
authorJoe Guo <joeg@catalyst.net.nz>
Wed, 8 May 2019 05:21:27 +0000 (17:21 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2019 08:19:16 +0000 (08:19 +0000)
While running samba python tests with `coverage.py`, `make test` failed
to start ad_dc env since dns_update_cache stays empty.
Flush the file after write fix the issue.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/scripting/bin/samba_dnsupdate

index 2ecb2ce9f1ddb8c5cc6293fc10996e847982a9c3..9d45de59fd6fc759da943a7906eb087142d6f569 100755 (executable)
@@ -940,6 +940,7 @@ if rebuild_cache:
         if opts.verbose:
             print("Adding %s to %s" % (str(d), file_name))
         wfile.write(str(d)+"\n")
+    wfile.flush()
     os.rename(tmpfile, dns_update_cache)
 fcntl.lockf(cfile, fcntl.LOCK_UN)