Skip to content

Commit 9446b35

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
sambacc: add a new dc interface config type
Add DCInterfaceConfig class to the config module that will track settings used to dynamically configure interfaces that the dc will incorporate. Signed-off-by: John Mulligan <[email protected]>
1 parent ce1b8f7 commit 9446b35

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sambacc/config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,21 @@ def __init__(self, drec: dict, instance_name: str):
507507
self.realm = drec["realm"]
508508
self.short_domain = drec.get("short_domain", "")
509509
self.admin_password = drec.get("admin_password", "")
510+
self.interface_config = DCInterfaceConfig(drec.get("interfaces", {}))
510511
self.dcname = instance_name
511512

512513

514+
class DCInterfaceConfig:
515+
def __init__(self, iface_config: dict) -> None:
516+
self.include_pattern: str = iface_config.get("include_pattern", "")
517+
self.exclude_pattern: str = iface_config.get("exclude_pattern", "")
518+
519+
@property
520+
def configured(self) -> bool:
521+
"""Return true if at least one interface property has been set."""
522+
return bool(self.include_pattern) or bool(self.exclude_pattern)
523+
524+
513525
class DomainUserEntry(UserEntry):
514526
def __init__(self, iconf: InstanceConfig, urec: dict, num: int):
515527
super().__init__(iconf, urec, num)

0 commit comments

Comments
 (0)