livemedia-creator: log more failure information

This switches on the rc checking in execWithRedirect and logs the error
it raises.
This commit is contained in:
Brian C. Lane 2014-07-02 15:10:14 -07:00
parent fd4afe2530
commit 5f96701caf

View File

@ -366,9 +366,11 @@ class VirtualInstall(object):
args.append("--arch")
args.append(arch)
rc = execWithRedirect("virt-install", args)
if rc:
raise InstallError("Problem starting virtual install")
log.info("Running virt-install.")
try:
execWithRedirect("virt-install", args, raise_err=True)
except subprocess.CalledProcessError as e:
raise InstallError("Problem starting virtual install: %s" % e)
conn = libvirt.openReadOnly(None)
dom = conn.lookupByName(self.virt_name)
@ -646,8 +648,13 @@ def novirt_install(opts, disk_img, disk_size, repo_url):
# Make sure anaconda has the right product and release
os.environ["ANACONDA_PRODUCTNAME"] = opts.project
os.environ["ANACONDA_PRODUCTVERSION"] = opts.releasever
rc = execWithRedirect("anaconda", args)
log.info("Running anaconda.")
try:
execWithRedirect("anaconda", args, raise_err=True)
except subprocess.CalledProcessError as e:
log.error("Running anaconda failed: %s", e)
raise InstallError("novirt_install failed")
finally:
# Move the anaconda logs over to a log directory
log_dir = os.path.abspath(os.path.dirname(opts.logfile))
log_anaconda = joinpaths(log_dir, "anaconda")
@ -673,9 +680,6 @@ def novirt_install(opts, disk_img, disk_size, repo_url):
if selinux_enforcing:
selinux.security_setenforce(1)
if rc:
raise InstallError("novirt_install failed")
if opts.qcow2:
log.info("Converting %s to qcow2", disk_img)
qcow2_args = []
@ -697,7 +701,7 @@ def novirt_install(opts, disk_img, disk_size, repo_url):
shutil.rmtree(ROOT_PATH)
if rc:
raise InstallError("novirt_install failed")
raise InstallError("novirt_install mktar failed: rc=%s" % rc)
def virt_install(opts, install_log, disk_img, disk_size):