From 8861002c962af283ce106054853dfdcfb89b1a3b Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Tue, 21 Dec 2021 14:40:35 -0600 Subject: [PATCH] fix for detecting ranges with no gateway set, #3 --- src/main/python/get_ip_ranges/source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/python/get_ip_ranges/source.py b/src/main/python/get_ip_ranges/source.py index ba41b35..ddcb684 100644 --- a/src/main/python/get_ip_ranges/source.py +++ b/src/main/python/get_ip_ranges/source.py @@ -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)