Skip to content
Snippets Groups Projects
Commit 3943b8de authored by Erik Reid's avatar Erik Reid
Browse files

fixed bogus redis key calculation

parent bb5f66d8
No related branches found
No related tags found
No related merge requests found
...@@ -125,23 +125,20 @@ def update_access_services(self): ...@@ -125,23 +125,20 @@ def update_access_services(self):
with db.connection(InventoryTask.config["ops-db"]) as cx: with db.connection(InventoryTask.config["ops-db"]) as cx:
for service in opsdb.get_access_services(cx): for service in opsdb.get_access_services(cx):
equipment_interface = '%s:%s' % ( if service['equipment'] in access_services:
service['equipment'], service['interface_name'])
if equipment_interface in access_services:
logger.warning( 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) r = get_next_redis(InventoryTask.config)
for key in r.scan_iter('opsdb:access_services:*'): for key in r.scan_iter('opsdb:access_services:*'):
r.delete(key) r.delete(key)
rp = r.pipeline() rp = r.pipeline()
for equipment_interface, services in access_services.items(): for equipment_interface, service in access_services.items():
rp.set( rp.set(
f'opsdb:access_services:{equipment_interface}', f'opsdb:access_services:{equipment_interface}',
json.dumps(services)) json.dumps(service))
rp.execute() rp.execute()
logger.debug('<<< update_access_services') logger.debug('<<< update_access_services')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment