From 4182d06a52d459dfb97cedd93f1cc61d121aa8cc Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Sun, 11 Nov 2018 10:33:02 +0100
Subject: [PATCH] save test data with new filenames

---
 inventory_provider/router_interfaces.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/inventory_provider/router_interfaces.py b/inventory_provider/router_interfaces.py
index 9156720a..07ce61d6 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)
-- 
GitLab