Merge "Capture output in _exec_sudo"

This commit is contained in:
Jenkins 2017-03-23 01:01:13 +00:00 committed by Gerrit Code Review
commit f7999f86e4

View File

@ -155,11 +155,13 @@ class Partitioning(object):
sudo_cmd = ["sudo"] sudo_cmd = ["sudo"]
sudo_cmd.extend(cmd) sudo_cmd.extend(cmd)
logger.info("Calling [%s]" % " ".join(sudo_cmd)) logger.info("Calling [%s]" % " ".join(sudo_cmd))
subp = subprocess.Popen(sudo_cmd) # note we supress output, as it is captured
rval = subp.wait() try:
if rval != 0: subprocess.check_output(sudo_cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
logger.error("Calling [%s] failed with [%s]" % logger.error("Calling [%s] failed with [%s]" %
(" ".join(sudo_cmd), rval)) (e.cmd, e.returncode))
logger.error(e.output)
logger.error("Trying to continue") logger.error("Trying to continue")
def _all_part_devices_exist(self, expected_part_devices): def _all_part_devices_exist(self, expected_part_devices):