summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-17 19:43:26 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-17 19:43:33 +1100
commit986627cd67f4ff48152fa5147977813e2b190a93 (patch)
tree5b99f5a98d6daad9768f973d5be20b3f972849a6 /source4/scripting/python
parentfd2556317f22ee02b341ca7ebbd02d7197fb1e4d (diff)
downloadsamba-986627cd67f4ff48152fa5147977813e2b190a93.tar.gz
samba-986627cd67f4ff48152fa5147977813e2b190a93.tar.bz2
samba-986627cd67f4ff48152fa5147977813e2b190a93.zip
s4-provision: freeze the DNS zone before creating the zone file
This prevents bind from getting confused if it has a journal for the zone.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/provision.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index b127d6cc54..1e1bf480f5 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -1375,7 +1375,7 @@ def provision(setup_dir, message, session_info,
# Only make a zone file on the first DC, it should be replicated
# with DNS replication
- create_zone_file(message, paths, setup_path, dnsdomain=names.dnsdomain,
+ create_zone_file(lp, message, paths, targetdir, setup_path, dnsdomain=names.dnsdomain,
hostip=hostip,
hostip6=hostip6, hostname=names.hostname,
realm=names.realm,
@@ -1486,7 +1486,7 @@ def create_phpldapadmin_config(path, setup_path, ldapi_uri):
{"S4_LDAPI_URI": ldapi_uri})
-def create_zone_file(message, paths, setup_path, dnsdomain,
+def create_zone_file(lp, message, paths, targetdir, setup_path, dnsdomain,
hostip, hostip6, hostname, realm, domainguid,
ntdsguid):
"""Write out a DNS zone file, from the info in the current database.
@@ -1527,6 +1527,11 @@ def create_zone_file(message, paths, setup_path, dnsdomain,
os.mkdir(dns_dir, 0775)
+ # we need to freeze the zone while we update the contents
+ if targetdir is None:
+ rndc = lp.get("rndc command")
+ os.system(rndc + " freeze " + lp.get("realm"))
+
setup_file(setup_path("provision.zone"), paths.dns, {
"HOSTNAME": hostname,
"DNSDOMAIN": dnsdomain,
@@ -1551,6 +1556,9 @@ def create_zone_file(message, paths, setup_path, dnsdomain,
except OSError:
message("Failed to chown %s to bind gid %u" % (dns_dir, paths.bind_gid))
+ if targetdir is None:
+ os.system(rndc + " unfreeze " + lp.get("realm"))
+
def create_named_conf(paths, setup_path, realm, dnsdomain,
private_dir):