remote.shortname, remotedir, localdir)
if not os.path.exists(localdir):
os.mkdir(localdir)
- r = remote.get_tar_stream(remotedir, sudo=True)
- tar = tarfile.open(mode='r|gz', fileobj=r.stdout)
+ r = remote.get_tar_stream(remotedir, sudo=True, compress=False)
+ tar = tarfile.open(mode='r|', fileobj=r.stdout)
while True:
ti = tar.next()
if ti is None:
self.remove(path)
return local_path
- def get_tar(self, path, to_path, sudo=False):
+ def get_tar(self, path, to_path, sudo=False, compress=True):
"""
Tar a remote directory and copy it locally
"""
args.append('sudo')
args.extend([
'tar',
- 'cz',
+ 'cz' if compress else 'c',
'-f', '-',
'-C', path,
'--',
self._sftp_get_file(remote_temp_path, to_path)
self.remove(remote_temp_path)
- def get_tar_stream(self, path, sudo=False):
+ def get_tar_stream(self, path, sudo=False, compress=True):
"""
Tar-compress a remote directory and return the RemoteProcess
for streaming
args.append('sudo')
args.extend([
'tar',
- 'cz',
+ 'cz' if compress else 'c',
'-f', '-',
'-C', path,
'--',