summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Bolognani <abologna@redhat.com>2021-12-02 16:13:26 +0100
committerDaniel Berrangé <berrange@redhat.com>2022-01-04 09:39:21 +0000
commited39fd79eb8fb2c6138ddd53762ed37165c0daed (patch)
tree9d42352d519d388e9e510196310920bdf10e2047
parent0038d750c9056ddd63cb48b343e451f8db2746fa (diff)
downloadvirt-manager-ed39fd79eb8fb2c6138ddd53762ed37165c0daed.tar.gz
installerinject: Add error detection for initrd injection
Any of the commands involved in injecting files into an initrd could fail, and if that happens we should interrupt the installation instead of proceeding as if nothing had happened. Signed-off-by: Andrea Bolognani <abologna@redhat.com>
-rw-r--r--virtinst/install/installerinject.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/virtinst/install/installerinject.py b/virtinst/install/installerinject.py
index 8445d21e..0b2a9bc5 100644
--- a/virtinst/install/installerinject.py
+++ b/virtinst/install/installerinject.py
@@ -43,6 +43,11 @@ def _run_initrd_commands(initrd, tempdir):
if gziperr: # pragma: no cover
log.debug("gzip stderr=%s", gziperr)
+ if (cpio_proc.returncode != 0 or
+ find_proc.returncode != 0 or
+ gzip_proc.returncode != 0): # pragma: no cover
+ raise RuntimeError("Failed to inject files into initrd")
+
def _run_iso_commands(iso, tempdir, cloudinit=False):
# These three programs all behave similarly for our needs, and