diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 4d156f7fb06370ac6357d28e875de07dc12e1940..b2e96b6522f9ca56bbb2015633178f087863fd0f 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -104,14 +104,15 @@ def ix_peering_info(peer_info): other = r.get(k.decode('utf-8')).decode('utf-8') other = json.loads(other) + peer_address = ipaddress.ip_address(other['name']) + if protocol != type(peer_address).__name__: + continue + if other['router'] == peer_info['router']: result['router'].append(other['name']) assert other['description'] is not None # sanity: as above... - if not other['description'].startswith(keyword): - continue - peer_address = ipaddress.ip_address(other['name']) - if protocol == type(peer_address).__name__: + if other['description'].startswith(keyword): result['group'].append(other['name']) return result