diff --git a/inventory_provider/router_interfaces.py b/inventory_provider/router_interfaces.py index 9156720a3b35ed52a06554ac0d9da798281a21e6..07ce61d6241b526243ec7438e24d5409575c44ae 100644 --- a/inventory_provider/router_interfaces.py +++ b/inventory_provider/router_interfaces.py @@ -52,14 +52,14 @@ def get_router_details(router, params, q): command_output = commands_proc_queue.get() assert len(command_output) == len(commands) - # for i, o in enumerate(command_output): - # with open("/tmp/%s-%d.output" % (router["hostname"], i), "w") as f: - # f.write(o) + for c, o in zip(commands, command_output): + with open("/tmp/%s-%s.output" % (router["hostname"], c["key"]), "w") as f: + f.write(o) result = {} for c, o in zip(commands, command_output): if c["key"]: - result[c] = c["parser"](o) + result[c["key"]] = c["parser"](o) commands_proc.join() threading_logger.debug("... got commands result & joined: %r" % router)