diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-01-09 18:31:03 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-01-09 18:31:03 +0200 |
commit | c9bda67b2b6d911228660e418a17527ebe4f458e (patch) | |
tree | 3024d216160e6ced016dac7fab0d1e272e633585 | |
parent | 43f1f878cab76a255db975600f6a41a1c6d683d8 (diff) | |
download | obnam-c9bda67b2b6d911228660e418a17527ebe4f458e.tar.gz |
Really fix Paramiko 1.16+ prefetching
-rw-r--r-- | obnamlib/plugins/sftp_plugin.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py index 66aedf61..44e93c07 100644 --- a/obnamlib/plugins/sftp_plugin.py +++ b/obnamlib/plugins/sftp_plugin.py @@ -555,7 +555,7 @@ class SftpFS(obnamlib.VirtualFileSystem): def cat(self, pathname): self._delay() f = self.open(pathname, 'rb') - self._prefetch(f) + self._prefetch(pathname, f) chunks = [] while True: chunk = f.read(self.chunk_size) @@ -566,7 +566,7 @@ class SftpFS(obnamlib.VirtualFileSystem): f.close() return ''.join(chunks) - def _prefetch(self, f): + def _prefetch(self, pathname, f): '''Call f.prefetch in the right way. Up to paramiko version 1.15.1, prefetch accepts no arguments. @@ -577,7 +577,7 @@ class SftpFS(obnamlib.VirtualFileSystem): if paramiko.__version_info__ < (1, 16): f.prefetch() else: - file_size = f.lstat().st_size + file_size = self.lstat(pathname).st_size f.prefetch(file_size) @ioerror_to_oserror |