don't let specific node failures fail us
This commit is contained in:
parent
5150e8ddd4
commit
918cf4446c
1 changed files with 8 additions and 1 deletions
|
|
@ -94,6 +94,8 @@ async def matrix_node_sd(device) -> Dict:
|
||||||
|
|
||||||
|
|
||||||
def matrix_workers_to_sd(device, workers) -> List:
|
def matrix_workers_to_sd(device, workers) -> List:
|
||||||
|
if len(workers) == 0:
|
||||||
|
return []
|
||||||
ipv4 = filter_ipv6(device["addresses"])[0]
|
ipv4 = filter_ipv6(device["addresses"])[0]
|
||||||
target_groups = []
|
target_groups = []
|
||||||
for worker_type, workers in workers.items():
|
for worker_type, workers in workers.items():
|
||||||
|
|
@ -125,7 +127,12 @@ async def matrix_sd(devices) -> List:
|
||||||
for device in devices:
|
for device in devices:
|
||||||
if "tag:matrix" not in device["tags"]:
|
if "tag:matrix" not in device["tags"]:
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
workers = await matrix_node_sd(device)
|
workers = await matrix_node_sd(device)
|
||||||
|
except Exception as e:
|
||||||
|
log.error(f"Failed parsing matrix node sd for device={device['hostname']}")
|
||||||
|
log.error(e)
|
||||||
|
workers = []
|
||||||
targets = matrix_workers_to_sd(device, workers)
|
targets = matrix_workers_to_sd(device, workers)
|
||||||
if targets:
|
if targets:
|
||||||
sd.append(targets)
|
sd.append(targets)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue