1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-14 20:23:54 +03:00

drs_utils: Split process_chunk() out into its own class

This makes it easier to add classes with new functionality without
having to figure out how to slot them into a linear class hierarchy.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15852

Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Jennifer Sutton
2024-07-23 17:24:28 +12:00
committed by Jo Sutton
parent 50fb8fc795
commit b6fd9e2211
2 changed files with 77 additions and 34 deletions

View File

@@ -954,9 +954,14 @@ class DCJoinContext(object):
def create_replicator(ctx, repl_creds, binding_options):
"""Creates a new DRS object for managing replications"""
return drs_utils.drs_Replicate(
"ncacn_ip_tcp:%s[%s]" % (ctx.server, binding_options),
ctx.lp, repl_creds, ctx.local_samdb, ctx.invocation_id)
repl = drs_utils.drs_ReplicatorImpl(
f"ncacn_ip_tcp:{ctx.server}[{binding_options}]",
ctx.lp,
repl_creds,
ctx.local_samdb,
ctx.invocation_id,
)
return repl
def join_replicate(ctx):
"""Replicate the SAM."""
@@ -989,6 +994,7 @@ class DCJoinContext(object):
binding_options += ",print"
repl = ctx.create_replicator(repl_creds, binding_options)
repl = drs_utils.drs_Replicator(repl, ctx.local_samdb)
repl.replicate(ctx.schema_dn, source_dsa_invocation_id,
destination_dsa_guid, schema=True, rodc=ctx.RODC,
@@ -1726,11 +1732,8 @@ class DCCloneAndRenameContext(DCCloneContext):
# We want to rename all the domain objects, and the simplest way to do
# this is during replication. This is because the base DN of the top-
# level replicated object will flow through to all the objects below it
binding_str = "ncacn_ip_tcp:%s[%s]" % (ctx.server, binding_options)
return drs_utils.drs_ReplicateRenamer(binding_str, ctx.lp, repl_creds,
ctx.local_samdb,
ctx.invocation_id,
ctx.base_dn, ctx.new_base_dn)
repl = super().create_replicator(repl_creds, binding_options)
return drs_utils.drs_ReplicateRenamer(repl, ctx.base_dn, ctx.new_base_dn)
def create_non_global_lp(ctx, global_lp):
"""Creates a non-global LoadParm based on the global LP's settings"""