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

add update_lg_routers to worker

parent 3fdc1c37
No related branches found
No related tags found
No related merge requests found
......@@ -117,6 +117,21 @@ def update_interfaces_to_services(self):
logger.debug('<<< update_interfaces_to_services')
@app.task(base=InventoryTask, bind=True)
def update_lg_routers(self):
logger.debug('>>> update_lg_routers')
r = get_next_redis(InventoryTask.config)
for k in r.scan_iter('opsdb:lg:*'):
r.delete(k)
with db.connection(InventoryTask.config["ops-db"]) as cx:
for r in opsdb.lookup_lg_routers(cx):
r.set(f'opsdb:lg:{r["name"]}', json.dumps(r))
logger.debug('<<< update_lg_routers')
@app.task(base=InventoryTask, bind=True)
def update_equipment_locations(self):
logger.debug('>>> update_equipment_locations')
......@@ -489,6 +504,7 @@ def launch_refresh_cache_all(config):
# juniper netconf & snmp data
subtasks = [
update_equipment_locations.apply_async(),
update_lg_routers.apply_async()
]
for hostname in _derive_router_hostnames(config):
logger.debug('queueing router refresh jobs for %r' % hostname)
......
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