cwd = os.getcwd()
- def new_volume_handler(deltarobj, cwd, backup_path, tarobj, base_name, volume_number):
+ def new_volume_handler(deltarobj, cwd, backup_path, encryption, tarobj, base_name, volume_number):
'''
Handles the new volumes
'''
deltarobj.logger.debug("opening volume %s" % volume_path)
- tarobj.open_volume(volume_path)
+ tarobj.open_volume(volume_path, encryption=encryption)
# wraps some args from context into the handler
- new_volume_handler = partial(new_volume_handler, self, cwd, backup_path)
+ new_volume_handler = partial(new_volume_handler, self, cwd, backup_path, self.crypto_ctx)
index_accu.write(bytes('{"type": "python-delta-tar-index", "version": 1, "backup-type": "full", "extra_data": %s}\n' % extra_data_str, 'UTF-8'))
cwd = os.getcwd()
- def new_volume_handler(deltarobj, cwd, backup_path, tarobj, base_name, volume_number):
+ def new_volume_handler(deltarobj, cwd, backup_path, encryption, tarobj, base_name, volume_number):
'''
Handles the new volumes
'''
# we convert relative paths into absolute because CWD is changed
if not os.path.isabs(volume_path):
volume_path = os.path.join(cwd, volume_path)
- tarobj.open_volume(volume_path)
+ tarobj.open_volume(volume_path, encryption=encryption)
+
+ if self.password is not None:
+ self.crypto_ctx = crypto.Decrypt (self.password)
backup_path = os.path.dirname(backup_tar_path)
if not os.path.isabs(backup_path):
backup_path = os.path.join(cwd, backup_path)
- new_volume_handler = partial(new_volume_handler, self, cwd, backup_path)
-
- if self.password is not None:
- self.crypto_ctx = crypto.Decrypt (self.password)
+ new_volume_handler = partial(new_volume_handler, self, cwd, backup_path, self.crypto_ctx)
tarobj = tarfile.TarFile.open(backup_tar_path,
mode='r' + self.mode,
last_lno = 0,
new_volume_handler = partial(self.new_volume_handler,
self._deltatar, self._cwd, is_full,
- os.path.dirname(index))
+ os.path.dirname(index), self._deltatar.crypto_ctx)
)
self._data.append(s)
else:
# update the new_volume_handler of tar_obj
tarobj.new_volume_handler = partial(self.new_volume_handler,
- self._deltatar, self._cwd, True, os.path.dirname(backup_path))
+ self._deltatar, self._cwd, True, os.path.dirname(backup_path),
+ self._deltatar.crypto_ctx)
s = dict(
curr_vol_no = None,
vol_fd = None,
self._deltatar.logger.warning('tarfile: %s' % e)
@staticmethod
- def new_volume_handler(deltarobj, cwd, is_full, backup_path, tarobj, base_name, volume_number):
+ def new_volume_handler(deltarobj, cwd, is_full, backup_path, encryption, tarobj, base_name, volume_number):
'''
Handles the new volumes
'''
# we convert relative paths into absolute because CWD is changed
if not os.path.isabs(volume_path):
volume_path = os.path.join(cwd, volume_path)
- tarobj.open_volume(volume_path)
+ tarobj.open_volume(volume_path, encryption=encryption)
def restore_file(self, file_data, index_data, path, l_no, unprefixed_path):
'''