From c247cc5c37932dbe1c1db85d7d948a4b83da112e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 19 Oct 2018 08:02:12 +0200 Subject: [PATCH] anaconda: don't crash when no target disk is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit self.storage.root_device may be None in such case. Instead, allow proper reporting that no space is available. Signed-off-by: Frédéric Pierret --- pyanaconda/ui/lib/space.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pyanaconda/ui/lib/space.py b/pyanaconda/ui/lib/space.py index 3679a33eb..9b15c474f 100644 --- a/pyanaconda/ui/lib/space.py +++ b/pyanaconda/ui/lib/space.py @@ -75,8 +75,11 @@ class FileSystemSpaceChecker(object): log.info("fs space: %s needed: %s", free, needed) self.success = (free > needed) if not self.success: - dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format) - self.deficit = dev_required_size - self.storage.root_device.size + if self.storage.root_device: + dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format) + self.deficit = dev_required_size - self.storage.root_device.size + else: + self.deficit = needed - free self.error_message = _(self.error_template) % self.deficit return self.success @@ -107,8 +110,11 @@ class DirInstallSpaceChecker(FileSystemSpaceChecker): log.info("fs space: %s needed: %s", free, needed) self.success = (free > needed) if not self.success: - dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format) - self.deficit = dev_required_size - self.storage.root_device.size + if self.storage.root_device: + dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format) + self.deficit = dev_required_size - self.storage.root_device.size + else: + self.deficit = needed - free self.error_message = _(self.error_template) % self.deficit return self.success -- 2.14.4