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

Brian C. Lane bcl at redhat.com
Fri Feb 20 16:58:56 UTC 2015


On Fri, Feb 20, 2015 at 11:50:40AM -0500, Robert Marshall wrote:
> 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..52aeaae 100644
> --- a/booty/ppc.py
> +++ b/booty/ppc.py
> @@ -27,14 +27,18 @@ 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:
> +        if (bootdev):
>              bootdisks = set([bootdev.disk])
> -        for dev in prepdevs:
> -            if dev.disk in bootdisks:
> -                return dev
> -
> +            # most of the time we want the above, but if it's mdarray then we
> +            # really want something else
> +            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]
>  
> -- 
> 1.8.3.1

Ack.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list