Lucas Meneghel Rodrigues | 26 Jun 2012 03:07
Picon
Favicon
Gravatar

[PATCH] boottool: Don't fail if can't parse an index entry

Running autotest on a OpenSUSE client (12.1), that is
grub-based, I've found that boottool would fail with:

Traceback (most recent call last):
  File "/usr/local/autotest/tools/boottool", line 1994, in <module>
    app.run()
  File "/usr/local/autotest/tools/boottool", line 1804, in run
    result = action_method()
  File "/usr/local/autotest/tools/boottool", line 1885, in action_info
    entries = self.grubby.get_entries()
  File "/usr/local/autotest/tools/boottool", line 1010, in get_entries
    entries[entry["index"]] = entry
KeyError: 'index'

Turns out that the code is assuming that we can always
parse an index from the raw grubby output, leading to
the above error when the assumption does not hold true.

Fortunately, this is easy to fix, just handle KeyErrors
and continue on to parse the rest of the split parts
of the raw output.

CC: Cleber Rosa <crosa <at> redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr <at> redhat.com>
---
 client/tools/boottool |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/client/tools/boottool b/client/tools/boottool
index d0e8ce0..794377b 100755
(Continue reading)


Gmane