forked from ungleich-public/cdist
Better format command error output.
This commit is contained in:
parent
0c4826ee97
commit
ea58cbd171
1 changed files with 10 additions and 4 deletions
|
@ -133,10 +133,16 @@ def handle_called_process_error(err, command):
|
||||||
# "stdout: {}\n"
|
# "stdout: {}\n"
|
||||||
# "stderr: {}").format(
|
# "stderr: {}").format(
|
||||||
# err.returncode, err.output, errout))
|
# err.returncode, err.output, errout))
|
||||||
raise cdist.Error("Command failed: " + " ".join(command) +
|
if err.output:
|
||||||
(" with returncode: {}\n"
|
output = err.output + '\n'
|
||||||
"stdout: {}").format(
|
else:
|
||||||
err.returncode, err.output))
|
output = ''
|
||||||
|
raise cdist.Error(("Command failed: '{}'\n"
|
||||||
|
"return code: {}\n"
|
||||||
|
"---- BEGIN stdout ----\n"
|
||||||
|
"{}"
|
||||||
|
"---- END stdout ----").format(
|
||||||
|
" ".join(command), err.returncode, output))
|
||||||
|
|
||||||
|
|
||||||
def _call_get_stdout(command, env=None, stderr=None):
|
def _call_get_stdout(command, env=None, stderr=None):
|
||||||
|
|
Loading…
Reference in a new issue