diff --git a/inventory_provider/routes/testing.py b/inventory_provider/routes/testing.py index ae169363e24aecb139aff4db8a7b871fb5c77045..29893be24e0a75c4cd109b69ba8ce79666bc812e 100644 --- a/inventory_provider/routes/testing.py +++ b/inventory_provider/routes/testing.py @@ -26,6 +26,7 @@ def update_interfaces_to_services_ims(): ims_worker.update_interfaces_to_services_ims.delay(use_current=True) return Response('OK') + @routes.route("update-circuit-hierarchy-ims", methods=['GET', 'POST']) def update_circuit_hierarchy_ims(): ims_worker.update_circuit_hierarchy_ims.delay(use_current=True) diff --git a/inventory_provider/tasks/ims_worker.py b/inventory_provider/tasks/ims_worker.py index 1da774f6c1b48bc4c9d4f1ef430a9d7cea78721c..41907eea3fa1fc81828576b36ef0439eddf7ad9d 100644 --- a/inventory_provider/tasks/ims_worker.py +++ b/inventory_provider/tasks/ims_worker.py @@ -32,11 +32,10 @@ def update_interfaces_to_services_ims(self, use_current=False): ds = IMS(c['api'], c['username'], c['password']) for service in ims_data.get_interface_services(ds): - equipment_interface = '%s:%s' % ( - service['equipment'], service['interface_name']) + equipment_interface = \ + f'{service["equipment"]}:{service["interface_name"]}' interface_services[equipment_interface].append(service) - if use_current: r = get_current_redis(InventoryTask.config) # scan with bigger batches, to mitigate network latency effects