TODO??? : provision: Only create hard links for ForestDnsZones if it exists on this DC
authorAndrew Bartlett <abartlet@samba.org>
Thu, 14 Aug 2014 02:47:38 +0000 (14:47 +1200)
committerStefan Metzmacher <metze@samba.org>
Tue, 26 Aug 2014 16:18:52 +0000 (18:18 +0200)
We might be a subdomain, and not host this partition.

Andrew Bartlett

Change-Id: I9aa32c5692cd9fd0a6bced8bea37cd8593b31906
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
TODO: Reviewed-by: Stefan Metzmacher <metze@samba.org>

TODO:

-    del partfile[domainzonedn]
-    del partfile[forestzonedn]
+    del domainzone_file
+    if forestzone_file:
+        del forestzone_file

Is the following:

    del partfile[domainzonedn]

really the same as:

    domainzone_file = partfile[domainzonedn]
    del domainzone_file

???

python/samba/provision/sambadns.py

index aca9116eec0fba973c0a74c611346fc62d618fd4..f8857028d3e6cd77d8d19694dcebb095186e3119 100644 (file)
@@ -806,22 +806,26 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
     # Link dns partitions and metadata
     domainzonedn = "DC=DOMAINDNSZONES,%s" % names.domaindn.upper()
     forestzonedn = "DC=FORESTDNSZONES,%s" % names.rootdn.upper()
+
     domainzone_file = partfile[domainzonedn]
-    forestzone_file = partfile[forestzonedn]
+    forestzone_file = partfile.get(forestzonedn)
+
     metadata_file = "metadata.tdb"
     try:
         os.link(os.path.join(samldb_dir, metadata_file),
             os.path.join(dns_samldb_dir, metadata_file))
         os.link(os.path.join(private_dir, domainzone_file),
             os.path.join(dns_dir, domainzone_file))
-        os.link(os.path.join(private_dir, forestzone_file),
-            os.path.join(dns_dir, forestzone_file))
+        if forestzone_file:
+            os.link(os.path.join(private_dir, forestzone_file),
+                    os.path.join(dns_dir, forestzone_file))
     except OSError:
         logger.error(
             "Failed to setup database for BIND, AD based DNS cannot be used")
         raise
-    del partfile[domainzonedn]
-    del partfile[forestzonedn]
+    del domainzone_file
+    if forestzone_file:
+        del forestzone_file
 
     # Copy root, config, schema partitions (and any other if any)
     # Since samdb is open in the current process, copy them in a child process