Skip to content

Commit 23c6402

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
sambacc: add files to include in smb.conf stub for ctdb
When using ctdb most of the configuration should be managed via the registry config via ctdb. However, there are some parameters you may need to be per-instance. As a quick and simple way of getting custom per host settings with ctdb allow for including additional files from the generated stub smb.conf file. Signed-off-by: John Mulligan <[email protected]>
1 parent a6055d7 commit 23c6402

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sambacc/config.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ def with_addc(self) -> bool:
301301
def ctdb_smb_config(self) -> CTDBSambaConfig:
302302
if not self.with_ctdb:
303303
raise ValueError("ctdb not supported in configuration")
304-
return CTDBSambaConfig()
304+
includes = self.ctdb_config().get("conf_file_includes", [])
305+
return CTDBSambaConfig(includes=includes)
305306

306307
def ctdb_config(self) -> JSONData:
307308
"""Common configuration of CTDB itself."""
@@ -317,6 +318,7 @@ def ctdb_config(self) -> JSONData:
317318
# this whole thing really needs to be turned into a real object type
318319
ctdb.setdefault("public_addresses", [])
319320
ctdb.setdefault("ctdb_port", 0)
321+
ctdb.setdefault("conf_file_includes", [])
320322
return ctdb
321323

322324
def domain(self) -> DomainConfig:
@@ -369,12 +371,18 @@ def __eq__(self, other: typing.Any) -> bool:
369371

370372

371373
class CTDBSambaConfig:
374+
def __init__(self, includes: typing.Optional[list[str]] = None) -> None:
375+
self._includes = includes
376+
372377
def global_options(self) -> typing.Iterable[typing.Tuple[str, str]]:
373-
return [
378+
opts = [
374379
("clustering", "yes"),
375380
("ctdb:registry.tdb", "yes"),
376-
("include", "registry"),
377381
]
382+
for include in self._includes or []:
383+
opts.append(("include", include))
384+
opts.append(("include", "registry"))
385+
return opts
378386

379387
def shares(self) -> typing.Iterable[ShareConfig]:
380388
return []

0 commit comments

Comments
 (0)