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 = []
|
CACHE_SD = []
|
||||||
|
|
||||||
|
|
||||||
async def tailscale_devices() -> List:
|
async def tailscale_devices() -> List[Dict]:
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
try:
|
try:
|
||||||
# https://github.com/tailscale/tailscale/blob/main/api.md#tailnet-devices-get
|
# 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)
|
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:
|
if len(workers) == 0:
|
||||||
return []
|
return []
|
||||||
ipv4 = ipv4_only(device["addresses"])[0]
|
ipv4 = ipv4_only(device["addresses"])[0]
|
||||||
|
|
@ -134,8 +134,8 @@ def matrix_workers_to_sd(tailnet, device, workers) -> List:
|
||||||
return target_groups
|
return target_groups
|
||||||
|
|
||||||
|
|
||||||
async def matrix_sd(tailnet, devices) -> List:
|
async def matrix_sd(tailnet, devices) -> List[Dict]:
|
||||||
sd = []
|
sd: List[Dict] = []
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if MATRIX_TAG not in device["tags"]:
|
if MATRIX_TAG not in device["tags"]:
|
||||||
continue
|
continue
|
||||||
|
|
@ -150,12 +150,12 @@ async def matrix_sd(tailnet, devices) -> List:
|
||||||
workers = {}
|
workers = {}
|
||||||
targets = matrix_workers_to_sd(tailnet, device, workers)
|
targets = matrix_workers_to_sd(tailnet, device, workers)
|
||||||
if targets:
|
if targets:
|
||||||
sd.append(targets)
|
sd = sd + targets
|
||||||
log.info(f"Found {len(sd)} matrix servcies")
|
log.info(f"Found {len(sd)} matrix servcies")
|
||||||
return sd
|
return sd
|
||||||
|
|
||||||
|
|
||||||
def plain_devices_sd(tailnet, devices) -> List:
|
def plain_devices_sd(tailnet, devices) -> List[Dict]:
|
||||||
sd = []
|
sd = []
|
||||||
for device in devices:
|
for device in devices:
|
||||||
targets = ipv4_only(device["addresses"])
|
targets = ipv4_only(device["addresses"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue