Make sure AP has a name before checking

Fixes KeyError: 'name' issue reported here: https://community.ubnt.com/t5/UniFi-Wireless/UniFi-WiFi-Nagios-Monitoring-Plugin/m-p/1805913#M205041
This commit is contained in:
Steve Jenkins
2017-01-20 13:35:15 -08:00
committed by GitHub
parent 9769ee443d
commit 31f58a1921

View File

@@ -88,7 +88,7 @@ for ap in aps:
offline_names.append(ap['name']) offline_names.append(ap['name'])
# If a specific AP was specified, record its specific status # If a specific AP was specified, record its specific status
if ap['name'] == args.ap: if hasattr(ap, 'name') and ap['name'] == args.ap:
ap_state = ap['state'] ap_state = ap['state']
if ap['state'] == 1: if ap['state'] == 1:
ap_code = OK ap_code = OK