summaryrefslogtreecommitdiff
path: root/obnamlib/plugins/restore_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-10-27 13:34:18 +0000
committerLars Wirzenius <liw@liw.fi>2013-10-27 13:34:18 +0000
commit446bf342f995d8f5de1dd7a5f627ac4c72487209 (patch)
tree648577cfd6ce8bbcddc8d5aae53ac4dfea701ced /obnamlib/plugins/restore_plugin.py
parent554570702c2077e3e8e7e6626374d1409f78d718 (diff)
downloadobnam-446bf342f995d8f5de1dd7a5f627ac4c72487209.tar.gz
Make restore not abort at first error
Diffstat (limited to 'obnamlib/plugins/restore_plugin.py')
-rw-r--r--obnamlib/plugins/restore_plugin.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py
index ed732e55..cb8afab4 100644
--- a/obnamlib/plugins/restore_plugin.py
+++ b/obnamlib/plugins/restore_plugin.py
@@ -151,6 +151,10 @@ class RestorePlugin(obnamlib.ObnamPlugin):
for pathname, metadata in self.repo.walk(gen, root, depth_first=True):
self.file_count += 1
self.app.ts['current'] = pathname
+ self.restore_safely(gen, pathname, metadata)
+
+ def restore_safely(self, gen, pathname, metadata):
+ try:
dirname = os.path.dirname(pathname)
if self.write_ok and not self.fs.exists('./' + dirname):
self.fs.makedirs('./' + dirname)
@@ -179,6 +183,12 @@ class RestorePlugin(obnamlib.ObnamPlugin):
logging.error(msg)
self.app.ts.notify(msg)
self.errors = True
+ except Exception, e:
+ # Reaching this code path means we've hit a bug, so we log a full traceback.
+ msg = "Failed to restore %s:" % (pathname,)
+ logging.exception(msg)
+ self.app.ts.notify(msg + " " + str(e))
+ self.errors = True
def restore_dir(self, gen, root, metadata):
logging.debug('restoring dir %s' % root)