[rhel7 2/3] Add some sanity checking to live payload (#1080396)
Brian C. Lane
bcl at redhat.com
Fri Aug 15 17:40:07 UTC 2014
From: Vratislav Podzimek <vpodzime at redhat.com>
If mounting the install tree fails in the live payload it is a fatal error we
should report and terminate the installation. The same applies to an attempt to
install no data.
Related: rhbz#1080396
Signed-off-by: Brian C. Lane <bcl at redhat.com>
---
pyanaconda/packaging/livepayload.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index 932410f..a95ac42 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -78,7 +78,9 @@ class LiveImagePayload(ImagePayload):
exn = PayloadSetupError("%s is not a valid block device" % (self.data.method.partition,))
if errorHandler.cb(exn) == ERROR_RAISE:
raise exn
- blivet.util.mount(osimg.path, INSTALL_TREE, fstype="auto", options="ro")
+ rc = blivet.util.mount(osimg.path, INSTALL_TREE, fstype="auto", options="ro")
+ if rc != 0:
+ raise PayloadInstallError("Failed to mount the install tree")
source = os.statvfs(INSTALL_TREE)
self.source_size = source.f_frsize * (source.f_blocks - source.f_bfree)
@@ -112,6 +114,10 @@ class LiveImagePayload(ImagePayload):
def install(self):
""" Install the payload. """
+
+ if self.source_size <= 0:
+ raise PayloadInstallError("Nothing to install")
+
self.pct_lock = Lock()
self.pct = 0
threadMgr.add(AnacondaThread(name=THREAD_LIVE_PROGRESS,
--
1.9.3
More information about the anaconda-patches
mailing list