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

use service name in redis key

parent 3943b8de
No related branches found
No related tags found
No related merge requests found
......@@ -125,19 +125,20 @@ def update_access_services(self):
with db.connection(InventoryTask.config["ops-db"]) as cx:
for service in opsdb.get_access_services(cx):
if service['equipment'] in access_services:
if service['name'] in access_services:
logger.warning(
f'got multiple access services for {service["equipment"]}')
'got multiple access services '
f'with name "{service["name"]}"')
access_services[service['equipment']] = service
access_services[service['name']] = 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, service in access_services.items():
for name, service in access_services.items():
rp.set(
f'opsdb:access_services:{equipment_interface}',
f'opsdb:access_services:{name}',
json.dumps(service))
rp.execute()
......
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