prevent nesting of services
This commit is contained in:
parent
292abae384
commit
5da9d04d7e
1 changed files with 6 additions and 6 deletions
|
|
@ -55,7 +55,7 @@ settings = Settings() # type: ignore[call-arg]
|
|||
CACHE_SD = []
|
||||
|
||||
|
||||
async def tailscale_devices() -> List:
|
||||
async def tailscale_devices() -> List[Dict]:
|
||||
async with httpx.AsyncClient() as client:
|
||||
try:
|
||||
# https://github.com/tailscale/tailscale/blob/main/api.md#tailnet-devices-get
|
||||
|
|
@ -107,7 +107,7 @@ async def matrix_node_sd(device) -> Dict:
|
|||
return group_by_type(data)
|
||||
|
||||
|
||||
def matrix_workers_to_sd(tailnet, device, workers) -> List:
|
||||
def matrix_workers_to_sd(tailnet, device, workers) -> List[Dict]:
|
||||
if len(workers) == 0:
|
||||
return []
|
||||
ipv4 = ipv4_only(device["addresses"])[0]
|
||||
|
|
@ -134,8 +134,8 @@ def matrix_workers_to_sd(tailnet, device, workers) -> List:
|
|||
return target_groups
|
||||
|
||||
|
||||
async def matrix_sd(tailnet, devices) -> List:
|
||||
sd = []
|
||||
async def matrix_sd(tailnet, devices) -> List[Dict]:
|
||||
sd: List[Dict] = []
|
||||
for device in devices:
|
||||
if MATRIX_TAG not in device["tags"]:
|
||||
continue
|
||||
|
|
@ -150,12 +150,12 @@ async def matrix_sd(tailnet, devices) -> List:
|
|||
workers = {}
|
||||
targets = matrix_workers_to_sd(tailnet, device, workers)
|
||||
if targets:
|
||||
sd.append(targets)
|
||||
sd = sd + targets
|
||||
log.info(f"Found {len(sd)} matrix servcies")
|
||||
return sd
|
||||
|
||||
|
||||
def plain_devices_sd(tailnet, devices) -> List:
|
||||
def plain_devices_sd(tailnet, devices) -> List[Dict]:
|
||||
sd = []
|
||||
for device in devices:
|
||||
targets = ipv4_only(device["addresses"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue