B offer to continue even when failed to restore systemonly stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Fri, 14 Aug 2009 22:21:45 +0200
branchstable
changeset 2861 9cb3027407aa
parent 2860 b2add17d5bc4
child 2862 08d214ffa514
B offer to continue even when failed to restore systemonly
server/migractions.py
--- a/server/migractions.py	Fri Aug 14 19:04:15 2009 +0200
+++ b/server/migractions.py	Fri Aug 14 22:21:45 2009 +0200
@@ -169,16 +169,15 @@
         bkup = tarfile.open(backupfile, 'r|gz')
         tmpdir = tempfile.mkdtemp()
         bkup.extractall(path=tmpdir)
-        if systemonly:
-            repo.system_source.restore(osp.join(tmpdir,'system'), drop=drop)
-        else:
-            for source in repo.sources:
-                try:
-                    source.restore(osp.join(tmpdir, source.uri), drop=drop)
-                except Exception, exc:
-                    print '-> error trying to restore [%s]' % exc
-                    if not self.confirm('Continue anyway?', default='n'):
-                        raise SystemExit(1)
+        for source in repo.sources:
+            if systemonly and source.uri != 'system':
+                continue
+            try:
+                source.restore(osp.join(tmpdir, source.uri), drop=drop)
+            except Exception, exc:
+                print '-> error trying to restore [%s]' % exc
+                if not self.confirm('Continue anyway?', default='n'):
+                    raise SystemExit(1)
         bkup.close()
         shutil.rmtree(tmpdir)
         # call hooks