From 89076e2d9d175f11f180abe762c6a953e5768498 Mon Sep 17 00:00:00 2001 From: Joel Andres Granados Date: Thu, 20 Nov 2008 14:16:31 +0100 Subject: Handle some corner cases with the revert function in the grub plugin. --- plugins/grub/grub.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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] -- cgit