From 04a11c11d7afcbb88301137ca221f65d68ac8168 Mon Sep 17 00:00:00 2001 From: Robert Latta <robert.latta@geant.org> Date: Tue, 13 Apr 2021 10:43:22 +0000 Subject: [PATCH] added UNKNOWN location for b end --- inventory_provider/tasks/worker.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py index cb946230..deb983a6 100644 --- a/inventory_provider/tasks/worker.py +++ b/inventory_provider/tasks/worker.py @@ -604,8 +604,16 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): s['logical_unit'] = '' # this is redundant I believe if 'port_b_id' in s: pd_b = port_id_details[s['port_b_id']][0] - loc_b = locations[pd_b['equipment_name']]['pop'] - s['other_end_pop_name'] = loc_a['name'] + location_b = locations.get(pd_b['equipment_name'], None) + if location_b: + loc_b = location_b['pop'] + else: + loc_b = locations['UNKNOWN_LOC']['pop'] + logger.warning( + f'Unable to find location for {pd_b["equipment_name"]} - ' + f'Service ID {s["id"]}') + + s['other_end_pop_name'] = loc_b['name'] s['other_end_pop_abbreviation'] = loc_b['abbreviation'] s['other_end_equipment'] = pd_b['equipment_name'] s['other_end_port'] = pd_b['interface_name'] -- GitLab