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

Vratislav Podzimek vpodzime at redhat.com
Wed Feb 25 08:00:40 UTC 2015


On Fri, 2015-02-20 at 11:50 -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):
I guess you've already pushed that, but for next time -- python doesn't
require parentheses around the condition in the if statement. And we
don't use them unless they are needed for better readability or to
specify/change the priority of boolean operations.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list