Capture output in _exec_sudo
The stdout of the script is captured, so anything coming out from these commands needs to be captured. Move to check_process and show the output as part of an error log in failure case. Change-Id: I1150375cdc479d4f19b8ddeb49a824ab16fdf831
This commit is contained in:
parent
f1d53f2e31
commit
a8f2eaded8
@ -155,11 +155,13 @@ class Partitioning(object):
|
||||
sudo_cmd = ["sudo"]
|
||||
sudo_cmd.extend(cmd)
|
||||
logger.info("Calling [%s]" % " ".join(sudo_cmd))
|
||||
subp = subprocess.Popen(sudo_cmd)
|
||||
rval = subp.wait()
|
||||
if rval != 0:
|
||||
# note we supress output, as it is captured
|
||||
try:
|
||||
subprocess.check_output(sudo_cmd, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error("Calling [%s] failed with [%s]" %
|
||||
(" ".join(sudo_cmd), rval))
|
||||
(e.cmd, e.returncode))
|
||||
logger.error(e.output)
|
||||
logger.error("Trying to continue")
|
||||
|
||||
def _all_part_devices_exist(self, expected_part_devices):
|
||||
|
Loading…
Reference in New Issue
Block a user