[PATCH/rhel6-branch] Handle NoneType Exception after deleting PPC partitions (#1021445)

Robert Marshall rmarshall at redhat.com
Fri Feb 6 19:17:33 UTC 2015


Users reported that the installer would crash when deleting all
existing partitions on the PowerPC Platform. This crash occurred
because the installer preferentially looks for a PRePBoot on the
same partition as /boot and, if it couldn't find any partitions
assigned to the /boot mount point, the object containing
boot devices would be null and the subsequent calls to that
object would trigger the failure. Modified the code such that
it checks if the value is NoneType and, if it is, simply skip
the codeblock that performs the preferential lookup. Updated the
type check for mdarray to validate the presence of the type
attribute so that, if the boot device object does not include
the type attribute, it will pick the sane default as intended.

Resolves rhbz#1021445
---
 booty/ppc.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/booty/ppc.py b/booty/ppc.py
index 2cb2103..d7184ba 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -6,6 +6,7 @@ from util import getDiskPart
 from bootloaderInfo import *
 import iutil
 import parted
+import types
 
 class ppcBootloaderInfo(bootloaderInfo):
     def pickPReP(self):
@@ -27,13 +28,16 @@ class ppcBootloaderInfo(bootloaderInfo):
 
         # we'd prefer a PReP partition that's on the same disk as /boot.
         bootdev = self.storage.mountpoints.get("/boot",self.storage.rootDevice)
-        if bootdev.type == "mdarray":
-            bootdisks = set(p.disk for p in bootdev.parents)
-        else:
-            bootdisks = set([bootdev.disk])
-        for dev in prepdevs:
-            if dev.disk in bootdisks:
-                return dev
+
+	# If the /boot drive was deleted then bootdev will be NoneType
+	if not isinstance(bootdev, types.NoneType):
+	    bootdisks = set([bootdev.disk])
+	    if hasattr(bootdev, 'type'):
+		if bootdev.type == "mdarray":
+		    bootdisks = set(p.disk for p in bootdev.parents)
+	    for dev in prepdevs:
+		if dev.disk in bootdisks:
+		    return dev
 
         # failing that, return the first PReP partition we found
         return prepdevs[0]
-- 
2.1.0



More information about the anaconda-patches mailing list