Skip to content

Commit

Permalink
Allow empty offloader config
Browse files Browse the repository at this point in the history
  • Loading branch information
awlx authored Jan 13, 2022
1 parent 3afa304 commit e4dd634
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions unifi_respondd/unifi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,15 @@ def get_infos():
)
except:
pass
neighbour_mac = cfg.offloader_mac.get(site["desc"], None)
offloader_id = cfg.offloader_mac.get(site["desc"], "").replace(':', '')
offloader = list(filter(lambda x:x["mac"]==cfg.offloader_mac.get(site["desc"], ""),ffnodes["nodes"]))[0]
try:
neighbour_mac = cfg.offloader_mac.get(site["desc"], None)
offloader_id = cfg.offloader_mac.get(site["desc"], "").replace(':', '')
offloader = list(filter(lambda x:x["mac"]==cfg.offloader_mac.get(site["desc"], ""),ffnodes["nodes"]))[0]
except:
neighbour_mac = None
offloader_id = None
offloader = {}
pass
uplink = ap.get("uplink", None)
if uplink is not None and uplink.get("ap_mac", None) is not None:
neighbour_mac = uplink.get("ap_mac")
Expand All @@ -190,11 +196,11 @@ def get_infos():
mem_total=ap.get("sys_stats", {}).get("mem_total", 0),
tx_bytes=tx,
rx_bytes=rx,
gateway=offloader["gateway"],
gateway6=offloader["gateway6"],
gateway=offloader.get("gateway", None),
gateway6=offloader.get("gateway6", None),
gateway_nexthop=offloader_id,
neighbour_mac=neighbour_mac,
domain_code=offloader["domain"],
domain_code=offloader.get("domain", None),
)
)
return aps
Expand Down

0 comments on commit e4dd634

Please sign in to comment.