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

use _derive_router_hostnames for list of hostnames

parent 379438c7
No related branches found
No related tags found
No related merge requests found
......@@ -144,14 +144,8 @@ def update_equipment_locations():
for k in r.scan_iter('opsdb:location:*'):
r.delete(k)
hostnames = []
for k in r.keys('netconf:*'):
m = re.match('^netconf:(.+)$', k.decode('utf-8'))
assert m
hostnames.append(m.group(1))
with db.connection(InventoryTask.config["ops-db"]) as cx:
for h in hostnames:
for h in _derive_router_hostnames(InventoryTask.config):
for ld in opsdb.lookup_pop_info(cx, h):
r.set('opsdb:location:%s' % h, json.dumps(ld))
......
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