From 3943b8de660cca386663dffea20286a6bd2599e7 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Tue, 10 Mar 2020 10:54:16 +0100 Subject: [PATCH] fixed bogus redis key calculation --- inventory_provider/tasks/worker.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py index ef2850a4..557de117 100644 --- a/inventory_provider/tasks/worker.py +++ b/inventory_provider/tasks/worker.py @@ -125,23 +125,20 @@ def update_access_services(self): with db.connection(InventoryTask.config["ops-db"]) as cx: for service in opsdb.get_access_services(cx): - equipment_interface = '%s:%s' % ( - service['equipment'], service['interface_name']) - - if equipment_interface in access_services: + if service['equipment'] in access_services: logger.warning( - f'got multiple access services for {equipment_interface}') + f'got multiple access services for {service["equipment"]}') - access_services[equipment_interface] = service + access_services[service['equipment']] = service r = get_next_redis(InventoryTask.config) for key in r.scan_iter('opsdb:access_services:*'): r.delete(key) rp = r.pipeline() - for equipment_interface, services in access_services.items(): + for equipment_interface, service in access_services.items(): rp.set( f'opsdb:access_services:{equipment_interface}', - json.dumps(services)) + json.dumps(service)) rp.execute() logger.debug('<<< update_access_services') -- GitLab