diff options
author | Joel Andres Granados <jgranado@redhat.com> | 2008-11-20 14:16:31 +0100 |
---|---|---|
committer | Joel Andres Granados <jgranado@redhat.com> | 2008-11-20 14:16:31 +0100 |
commit | 89076e2d9d175f11f180abe762c6a953e5768498 (patch) | |
tree | 29469a5bcead4eee7fb6893ae41556d5e142bee5 | |
parent | c5d0300ce1f2cb221e1102db8d77251f68d0c3d0 (diff) | |
download | firstaidkit-89076e2d9d175f11f180abe762c6a953e5768498.tar.gz firstaidkit-89076e2d9d175f11f180abe762c6a953e5768498.tar.xz firstaidkit-89076e2d9d175f11f180abe762c6a953e5768498.zip |
Handle some corner cases with the revert function in the grub plugin.
-rw-r--r-- | plugins/grub/grub.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/grub/grub.py b/plugins/grub/grub.py index 7fe928c..d026dd5 100644 --- a/plugins/grub/grub.py +++ b/plugins/grub/grub.py @@ -45,7 +45,17 @@ class Grub(Plugin): """ Use the backup object to replace the first 446 bytes in all devs. """ report.info("Entering revert...", origin = Grub) - firstblockdict = backup.restoreValue("firstblockdict") + try: + firstblockdict = backup.restoreValue("firstblockdict") + except: + report.debug("I found the grub backup dir empty", origin = Grub) + return + + if len(firstblockdict) == 0: + report.info("I found a backup object but it had no elements to " \ + "backup, exiting...", origin = Grub) + return + for (dev, val) in firstblockdict.iteritems(): devpath = val[1].path() first446bytes = val[0] |