Return the output from failed commands in CalledProcessError

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
This commit is contained in:
Brian C. Lane 2015-08-04 10:50:37 -07:00
parent b23bef069a
commit 522ec34360

View File

@ -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)