[master 1/1] Return the output from failed commands in CalledProcessError

bcl installerbot-noreply at redhat.com
Tue Aug 4 17:52:57 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

Some callers expect CalledProcessError.output to have the output, so
pass up the stdout + stderr output.

This means failed runcmd template commands will log to program.log and
lorax.log
---
 src/pylorax/executils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pylorax/executils.py b/src/pylorax/executils.py
index 25c9eef..4d7d611 100644
--- a/src/pylorax/executils.py
+++ b/src/pylorax/executils.py
@@ -195,7 +195,8 @@ def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_ou
         program_log.debug("Return code: %d", proc.returncode)
 
     if proc.returncode and raise_err:
-        raise subprocess.CalledProcessError(proc.returncode, argv)
+        output = output_string or "" + err_string or ""
+        raise subprocess.CalledProcessError(proc.returncode, argv, output)
 
     return (proc.returncode, output_string)
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/lorax/commit/522ec34360e9f7a2391e2437b57af57a4d019b72


More information about the anaconda-patches mailing list