On Tue, 2015-02-24 at 15:07 -0500, Robert Marshall wrote:
Users reported an unhandled AttributeError NoneType while upgrading
from RHEL6.5 to RHEL6.6. Added a guard against the dev not existing
when looked up by name. NOTE: in both cases the fail was due to the
multipath device not being found - this will skip it but based on
comments on the code it should be ignored anyway and this guard
will ensure it doesn't crash the installer.
Resolves rhbz#1129499
---
booty/x86.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/booty/x86.py b/booty/x86.py
index 90540c5..8fbabf3 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -48,14 +48,19 @@ class x86BootloaderInfo(efiBootloaderInfo):
# physical disks ("hda"), and real partitions on physical disks
# ("hda1"). Anything else gets ignored.
dev = self.storage.devicetree.getDeviceByName(device)
- if dev.type == "mdarray":
- if dev.level != 1:
- log.error("x86BootloaderInfo.getPhysicalDevices ignoring non
"
- "level 1 raid array %s" % dev.name)
- return []
- devs = dev.parents
- else:
+ if (dev):
Same comment about parentheses as in one of the previous
patches. Python
doesn't require them and we don't use them in simple expressions after
if.
devs = [ dev ]
I know you're not changing this
line, but could you please remove the
spaces around 'dev' as part of this patch?
+ # the above is what we normally want, but if it's
mdarray then let's
+ # do something different
+ if (hasattr(dev, 'type')):
+ if dev.type == "mdarray":
+ if dev.level != 1:
+ log.error("x86BootloaderInfo.getPhysicalDevices ignoring
non "
+ "level 1 raid array %s" % dev.name)
+ return []
+ devs = dev.parents
+ else:
+ devs = []
Is there any difference between 'return []' and
'devs = []' here? If so,
why is one used few lines before and the other here?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic