[PATCH 15/22] provision: Only create hard links for ForestDnsZones if it exists on this DC
abartlet at samba.org
abartlet at samba.org
Tue Aug 19 20:06:50 MDT 2014
From: Andrew Bartlett <abartlet at samba.org>
We might be a subdomain, and not host this partition.
Andrew Bartlett
Change-Id: I9aa32c5692cd9fd0a6bced8bea37cd8593b31906
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
python/samba/provision/sambadns.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py
index aca9116..1e3fe1c 100644
--- a/python/samba/provision/sambadns.py
+++ b/python/samba/provision/sambadns.py
@@ -806,22 +806,28 @@ 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()
+ has_forestdnszone = forestzonedn in partfile
+
domainzone_file = partfile[domainzonedn]
- forestzone_file = partfile[forestzonedn]
+ if has_forestdnszone:
+ forestzone_file = partfile[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 has_forestdnszone:
+ 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]
+ if has_forestdnszone:
+ del partfile[forestzonedn]
# Copy root, config, schema partitions (and any other if any)
# Since samdb is open in the current process, copy them in a child process
--
2.0.1
More information about the samba-technical
mailing list