handle strange input without crashing
This commit is contained in:
parent
690834390a
commit
5486d923bd
2 changed files with 12 additions and 1 deletions
|
|
@ -1,9 +1,10 @@
|
|||
image: python:3.11
|
||||
image: python:3.11-bookwork
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
test:
|
||||
image: python:3.11-bookworm
|
||||
stage: test
|
||||
variables:
|
||||
TAILSCALESD_API_KEY: tskey-dummy
|
||||
|
|
|
|||
|
|
@ -140,6 +140,16 @@ def matrix_workers_to_sd(tailnet, device, workers) -> List[Dict]:
|
|||
async def matrix_sd(tailnet, devices) -> List[Dict]:
|
||||
sd: List[Dict] = []
|
||||
for device in devices:
|
||||
hostname = device.get("hostname", None)
|
||||
if not hostname:
|
||||
log.warn("device doesn't have a hostname!", extra={"device": device})
|
||||
continue
|
||||
if "tags" not in device:
|
||||
log.warn(
|
||||
f"device does not have any tags! hostname={hostname}",
|
||||
extra={"device": device},
|
||||
)
|
||||
continue
|
||||
if MATRIX_TAG not in device["tags"]:
|
||||
continue
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue