diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py index 5335b0b5a0b3c3ba41522d2bc4857f01b1670745..045bef10e7c2cd8a641673c6b305e01b479ca0ae 100644 --- a/inventory_provider/tasks/worker.py +++ b/inventory_provider/tasks/worker.py @@ -146,8 +146,10 @@ def update_equipment_locations(): with db.connection(InventoryTask.config["ops-db"]) as cx: 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)) + # lookup_pop_info returns a list of locations + # (there can sometimes be more than one match) + locations = list(opsdb.lookup_pop_info(cx, h)) + r.set('opsdb:location:%s' % h, json.dumps(locations)) logger.debug('<<< update_equipment_locations')