fix for detecting ranges with no gateway set, #3

This commit is contained in:
John Bowdre 2021-12-21 14:40:35 -06:00
parent 9d85a69eed
commit 8861002c96

View file

@ -84,7 +84,7 @@ def do_get_ip_ranges(self, auth_credentials, cert):
ipRange['dnsServerAddresses'] = []
# try to get the address marked as the gateway in IPAM
gw_req = requests.get(f"{subnet_uri}/{subnet['id']}/addresses/?filter_by=is_gateway&filter_value=1", headers=token, verify=cert)
if gw_req.status_code == 200:
if gw_req.status_code == 200 and not 'data' in gw_req.json():
gateway = gw_req.json()['data'][0]['ip']
ipRange['gatewayAddress'] = gateway
logging.debug(ipRange)