]> xenbits.xensource.com Git - xen.git/commit
pygrub: Fix regression from c/s d1b93ea, attempt 2
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Tue, 25 Nov 2014 16:11:50 +0000 (11:11 -0500)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 27 Feb 2015 15:16:32 +0000 (15:16 +0000)
commitbc0ce24c8f1ba7a80a575d2f6593cc12aaa31e0f
treee99032eb212bf2d660c267d7205c1cdf78f943a4
parent7962c936a4637af4c1562ebd6bcf50d5193d936b
pygrub: Fix regression from c/s d1b93ea, attempt 2

c/s d1b93ea causes substantial functional regressions in pygrub's ability to
parse bootloader configuration files.

c/s d1b93ea itself changed an an interface which previously used exclusively
integers, to using strings in the case of a grub configuration with explicit
default set, along with changing the code calling the interface to require a
string.  The default value for "default" remained as an integer.

As a result, any Extlinux or Lilo configuration (which drives this interface
exclusively with integers), or Grub configuration which doesn't explicitly
declare a default will die with an AttributeError when attempting to call
"self.cf.default.isdigit()" where "default" is an integer.

Sadly, this AttributeError gets swallowed by the blanket ignore in the loop
which searches partitions for valid bootloader configurations, causing the
issue to be reported as "Unable to find partition containing kernel"

We should explicitly check type of "default" in image_index() and process it
appropriately.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
(cherry picked from commit 3b279811707dab4bab95c2e952e94ebf4d6badd9)
tools/pygrub/src/pygrub [changed mode: 0644->0755]