[PATCH 15/22] provision: Only create hard links for ForestDnsZones if it exists on this DC

Jelmer Vernooij jelmer at samba.org
Mon Aug 25 09:53:52 MDT 2014


On Wed, Aug 20, 2014 at 02:06:50PM +1200, abartlet at samba.org wrote:
> 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"

Nitpicky: I would write this as just:

       forestzone_file = partfile.get(forestzonedn)

(get returns None if the key does not exist)

and then lower in the file:

       if forestzone_file:
           os.link(os.path.join(private_dir, forestzone_file),
                   os.path.join(dns_dir, forestzone_file))

-- 
Jelmer Vernooij <jelmer at samba.org> - https://jelmer.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140825/a3115e11/attachment.pgp>


More information about the samba-technical mailing list