Mon, Nov 16, 2015 at 02:27:06PM CET, olichtne(a)redhat.com wrote:
From: Ondrej Lichtner <olichtne(a)redhat.com>
This extends the format_res_data method to support lists. This is very
usefull for test modules that return multiple entries of result data,
for example Netperf with multiple runs.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/NetTestCommand.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index 7385e47..409076b 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -332,6 +332,13 @@ class NetTestCommandGeneric(object):
if type(value) == dict:
formatted_data += level*4*" " + str(key) + ":\n"
formatted_data += self.format_res_data(value, level+1)
+ if type(value) == list:
+ formatted_data += level*4*" " + str(key) + ":\n"
+ for i in range(0, len(value)):
+ formatted_data += (level+1)*4*" " +\
+ "item %d:" % (i+1) + "\n"
+ formatted_data += self.format_res_data(value[i],
+ level+2)
else:
formatted_data += level*4*" " + str(key) + ":" +
\
(max_key_len-len(key))*" " + \
--
2.6.2
Ack to series.
Acked-by: Jan Tluka <jtluka(a)redhat.com>