From: Klaus Aehlig <[email protected]>

If a command fails/succeeds that should not do so,
show stdout and stderr. This information can be
relevant for debugging.

Signed-off-by: Klaus Aehlig <[email protected]>
Reviewed-by: Petr Pudlak <[email protected]>

Cherry-picked-from: 7f7c9c2cc2fa7acccc9040ae12e454dbeac48d6f
Signed-off-by: Hrvoje Ribicic <[email protected]>
---
 qa/qa_utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qa/qa_utils.py b/qa/qa_utils.py
index 5ed9eba..b1d66b2 100644
--- a/qa/qa_utils.py
+++ b/qa/qa_utils.py
@@ -187,7 +187,11 @@ def AssertCommand(cmd, fail=False, node=None, 
log_cmd=True, max_seconds=None):
   rcode = popen.returncode
   duration_seconds = TimedeltaToTotalSeconds(datetime.datetime.now() - start)
   if fail is not None:
-    _AssertRetCode(rcode, fail, cmdstr, nodename)
+    try:
+      _AssertRetCode(rcode, fail, cmdstr, nodename)
+    except:
+      print "Stdout was:\n%s\nStderr was:\n%s\n" % (stdout, stderr)
+      raise
 
   if max_seconds is not None:
     if duration_seconds > max_seconds:
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to