From 36085a222cb4b837568f00192828594d26692c0e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 14 Aug 2014 14:47:38 +1200 Subject: provision: Only create hard links for ForestDnsZones if it exists on this DC We might be a subdomain, and not host this partition. Andrew Bartlett Change-Id: I9aa32c5692cd9fd0a6bced8bea37cd8593b31906 Signed-off-by: Andrew Bartlett Reviewed-by: Jelmer Vernooij --- python/samba/provision/sambadns.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'python/samba/provision/sambadns.py') diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py index aca9116eec..9dbea4ef2a 100644 --- a/python/samba/provision/sambadns.py +++ b/python/samba/provision/sambadns.py @@ -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] + if forestzone_file: + 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 -- cgit