1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

join: Remove unnecessary clone_only flag

For the clone-only case, we have been avoiding a block of code in the
DCJoinContext's __init__(). The main reason we do this is because the
netbios_name is None for clones, and this block of code tries to derive
a bunch of values based on the netbios_name (otherwise, a few lines into
this block, it tries to do NoneType.lower(), which Python doesn't like
very much).

This code is not particularly clone-specific - it is just never going to
work if the netbios_name is None. So we can change the conditional
check, which allows us to get rid of the clone_only flag.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Tue Jul  3 08:12:10 CEST 2018 on sn-devel-144
This commit is contained in:
Tim Beale
2018-06-29 10:40:58 +12:00
committed by Gary Lockyer
parent 3230c345da
commit c2422593f4

View File

@ -56,8 +56,8 @@ class DCJoinContext(object):
def __init__(ctx, logger=None, server=None, creds=None, lp=None, site=None,
netbios_name=None, targetdir=None, domain=None,
machinepass=None, use_ntvfs=False, dns_backend=None,
promote_existing=False, clone_only=False,
plaintext_secrets=False, backend_store=None):
promote_existing=False, plaintext_secrets=False,
backend_store=None):
if site is None:
site = "Default-First-Site-Name"
@ -117,7 +117,10 @@ class DCJoinContext(object):
ctx.acct_pass = samba.generate_random_machine_password(128, 255)
ctx.dnsdomain = ctx.samdb.domain_dns_name()
if not clone_only:
# the following are all dependent on the new DC's netbios_name (which
# we expect to always be specified, except when cloning a DC)
if netbios_name:
# work out the DNs of all the objects we will be adding
ctx.myname = netbios_name
ctx.samname = "%s$" % ctx.myname
@ -1557,8 +1560,7 @@ class DCCloneContext(DCJoinContext):
include_secrets=False):
super(DCCloneContext, ctx).__init__(logger, server, creds, lp,
targetdir=targetdir, domain=domain,
dns_backend=dns_backend,
clone_only=True)
dns_backend=dns_backend)
# As we don't want to create or delete these DNs, we set them to None
ctx.server_dn = None