Skip to content

Commit 323295c

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
commands: allow filtering network interfaces when provisioning ad dc
Signed-off-by: John Mulligan <[email protected]>
1 parent f37b0b1 commit 323295c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sambacc/commands/addc.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,22 @@ def _prep_provision(ctx: Context) -> None:
8484
_logger.info(f"Provisioning domain: {domconfig.realm}")
8585

8686
dcname = ctx.cli.name or domconfig.dcname
87+
prov_opts = list(ctx.instance_config.global_options())
88+
explicit_ifaces = "interfaces" in dict(prov_opts)
89+
if domconfig.interface_config.configured and not explicit_ifaces:
90+
# dynamically select interfaces from the system to pass to the
91+
# provisioning command
92+
_logger.info("Dynamic interface selection enabled")
93+
ifaces = addc.filtered_interfaces(domconfig.interface_config)
94+
_logger.info("Selected interfaces: %s", ifaces)
95+
prov_opts.append(("interfaces", " ".join(ifaces)))
96+
prov_opts.append(("bind interfaces only", "yes"))
8797
addc.provision(
8898
realm=domconfig.realm,
8999
domain=domconfig.short_domain,
90100
dcname=dcname,
91101
admin_password=domconfig.admin_password,
92-
options=ctx.instance_config.global_options(),
102+
options=prov_opts,
93103
)
94104
_merge_config(_provisioned, ctx.instance_config.global_options())
95105

0 commit comments

Comments
 (0)