82aefe2
From e2c869393f9c1c0f1c84e1a817f411a2056d820e Mon Sep 17 00:00:00 2001
82aefe2
From: Lukas Czerner <lczerner@redhat.com>
82aefe2
Date: Thu, 16 Jan 2014 14:44:10 +0100
82aefe2
Subject: [PATCH 08/10] ssm: Suppress backtrace if command failed
82aefe2
82aefe2
Currently when command failed in misc.run(), RuntimeError() exception is
82aefe2
raised and backtrace is printed to the output. However this is not
82aefe2
desirable, so use problem.CommandFailed() exception which allows us to
82aefe2
catch it and print out reasonable error message.
82aefe2
82aefe2
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
82aefe2
---
82aefe2
 ssmlib/misc.py | 3 ++-
82aefe2
 1 file changed, 2 insertions(+), 1 deletion(-)
82aefe2
82aefe2
diff --git a/ssmlib/misc.py b/ssmlib/misc.py
82aefe2
index dbfa6b1..3d99c07 100644
82aefe2
--- a/ssmlib/misc.py
82aefe2
+++ b/ssmlib/misc.py
82aefe2
@@ -24,6 +24,7 @@ import stat
82aefe2
 import tempfile
82aefe2
 import threading
82aefe2
 import subprocess
82aefe2
+from ssmlib import problem
82aefe2
 
82aefe2
 # List of temporary mount points which should be cleaned up
82aefe2
 # before exiting
82aefe2
@@ -480,7 +481,7 @@ def run(cmd, show_cmd=False, stdout=False, stderr=True, can_fail=False,
82aefe2
             print output
82aefe2
         if error is not None:
82aefe2
             print error
82aefe2
-        raise RuntimeError(err_msg)
82aefe2
+        raise problem.CommandFailed(err_msg)
82aefe2
 
82aefe2
     if not return_stdout:
82aefe2
         output = None
82aefe2
-- 
82aefe2
1.8.3.1
82aefe2