Skip to content
Snippets Groups Projects
Commit 3fd4fe15 authored by Robert Latta's avatar Robert Latta
Browse files

Corrected update_interfaces_to_services function

parent 0118d251
No related branches found
No related tags found
No related merge requests found
import json
from collections import defaultdict
from inventory_provider import db
......@@ -20,14 +21,17 @@ def update_services_to_monitor(services):
def update_interfaces_to_services(services):
r = db.get_redis()
mapped_interfaces = {}
mapped_interfaces = defaultdict(list)
r.delete(interfaces_key)
for service in services:
key = "{}::{}".format(
service['equipment'],
service['interface_name']
)
r.hset(interfaces_key, key, json.dumps(mapped_interfaces[key]))
mapped_interfaces[key].append(service)
for key, value in mapped_interfaces.items():
r.hset(interfaces_key, key, json.dumps(value))
def update_service_hierarchy(records):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment