use real new volume handler during rescue
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Fri, 25 Aug 2017 15:41:21 +0000 (17:41 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 2 Apr 2018 11:34:09 +0000 (13:34 +0200)
With the dummy we end up with a nil object instead of a tarinfo
at the end of the volume. Reinstating the actual handler is
harmless and produces a valid info object again.

deltatar/deltatar.py
testing/test_recover.py

index f5c39f0..221b7b3 100644 (file)
@@ -1633,8 +1633,7 @@ class RestoreHelper(object):
             self.canchown = False
 
         if isinstance (backup_index, list) is True:
-            def dummy_volume_handler (*_a, **_kwa):
-                pass
+            decryptor = self._deltatar.decryptor
             self._data = \
                 [{ "curr_vol_no" : None
                  , "vol_fd" : None
@@ -1645,8 +1644,11 @@ class RestoreHelper(object):
                  , "iterator" : None
                  , "last_itelement" : None
                  , "last_lno" : 0
-                 , "new_volume_handler" : dummy_volume_handler
-                 , "decryptor" : self._deltatar.decryptor
+                 , "new_volume_handler" :
+                            partial(self.new_volume_handler,
+                                    self._deltatar, self._cwd, True,
+                                    os.path.dirname(backup_path), decryptor)
+                 , "decryptor" : decryptor
                  }]
         elif index_list is not None:
             for index in index_list:
index 817c719..7c26504 100644 (file)
@@ -746,7 +746,9 @@ class RescueCorruptHoleBaseTest (RescueTest):
     MISMATCHES  = 1
 
 class RescueCorruptHoleTest (RescueCorruptHoleBaseTest):
-    FAILURES    = 2
+    FAILURES    = 0
+    MISMATCHES  = 1 # intersected by hole
+    MISSING     = 1 # excised by hole
 
 class RescueCorruptHoleGZTest (RescueCorruptHoleBaseTest):
     COMPRESSION = "#gz"