commit 38357131386d29209bcac5d0199802687fb7cb82
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Oct 27 17:11:42 2014 +0100
NetTestResultSerializer: dont print match when there is none
When the first match of a recipe failed the result serializer still
tried to print the match description resulting in an Exception.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestResultSerializer.py | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/lnst/Controller/NetTestResultSerializer.py
b/lnst/Controller/NetTestResultSerializer.py
index ae8bc7e..c007945 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -86,18 +86,21 @@ class NetTestResultSerializer:
recipe_head = "%s match: %d" % (recipe["name"],
recipe["match_num"])
output_pairs.append((recipe_head, recipe["result"]))
- output_pairs.append((4*" " + "Pool match description:",
""))
match = recipe["pool_match"]
- if "virtual" in match and match["virtual"]:
- output_pairs.append((4*" " + "Setup is using virtual
machines.",
- ""))
- for m_id, m in match["machines"].iteritems():
- output_pairs.append((4*" " + "host \"%s\" uses
\"%s\"" %\
- (m_id, m["target"]), ""))
- for if_id, pool_id in m["interfaces"].iteritems():
- output_pairs.append((6*" " + "interface
\"%s\" "\
- "matched to \"%s\""
%\
- (if_id, pool_id), ""))
+ if match != {}:
+ output_pairs.append((4*" " + "Pool match
description:", ""))
+ if "virtual" in match and match["virtual"]:
+ output_pairs.append((4*" " +\
+ "Setup is using virtual machines.",
+ ""))
+
+ for m_id, m in match["machines"].iteritems():
+ output_pairs.append((4*" " + "host \"%s\"
uses \"%s\"" %\
+ (m_id, m["target"]), ""))
+ for if_id, pool_id in m["interfaces"].iteritems():
+ output_pairs.append((6*" " + "interface
\"%s\" "\
+ "matched to
\"%s\"" %\
+ (if_id, pool_id), ""))
if recipe["result"] == "FAIL" and \
"err_msg" in recipe and recipe["err_msg"] !=
"":
Show replies by date