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): devs = [ dev ] + # 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 = []
physicalDevices = [] for dev in devs:
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?
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..8a1c20b 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 + if dev: + devs = [dev] + # 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 = [ dev ] + return []
physicalDevices = [] for dev in devs:
On Wed, 2015-02-25 at 10:52 -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..8a1c20b 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
if dev:
devs = [dev]
# the above is what we normally want, but if it's mdarray then let's
# do something different
Not a native speaker, but I'd say "# the above is what we normally want unless it's an mdarray" would be better here.
Other than the comment above this looks good to me.
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 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/booty/x86.py b/booty/x86.py index 90540c5..19ba316 100644 --- a/booty/x86.py +++ b/booty/x86.py @@ -48,14 +48,18 @@ 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 + if dev: + devs = [dev] + # mdarray is an exception to the general rule + 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 = [ dev ] + return []
physicalDevices = [] for dev in devs:
On Wed, 2015-02-25 at 16:08 -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 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/booty/x86.py b/booty/x86.py index 90540c5..19ba316 100644 --- a/booty/x86.py +++ b/booty/x86.py @@ -48,14 +48,18 @@ 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
if dev:
devs = [dev]
# mdarray is an exception to the general rule
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 = [ dev ]
return [] physicalDevices = [] for dev in devs:
Looks good to me now.
anaconda-patches@lists.fedorahosted.org