diff --git a/inventory_provider/tasks/data.py b/inventory_provider/tasks/data.py index 4f01fb37139df58fde6eeff789fcf2374c494baf..15527bdb7865a47fedb18e9f7cf6af78ab15f15f 100644 --- a/inventory_provider/tasks/data.py +++ b/inventory_provider/tasks/data.py @@ -18,12 +18,17 @@ def build_service_interface_user_list(config): r = get_next_redis(config) for k in r.scan_iter('netconf-interfaces:*'): k = k.decode('utf-8') - (_, router_name, ifc_name) = k.split(':') + m = re.match('^netconf-interfaces:([^:]+):(.+)$', k) + if not m: + logger.error('invalid redis key: "{k}"') + continue # skip, rather than fail the entire update + router_name = m.group(1) + ifc_name = m.group(2) info = r.get(k).decode('utf-8') info = json.loads(info) - assert ifc_name == info['name'] + assert ifc_name == info['name'] # sanity yield { 'router': router_name, 'interface': info['name'],