Skip to content

Commit

Permalink
Use SFTP flags for reading
Browse files Browse the repository at this point in the history
  • Loading branch information
pkittenis committed Feb 15, 2018
1 parent 2420134 commit b00a4da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Fixes
--------

* ``ParallelSSH2Client.join`` timeout duration was incorrectly for per-host rather than total.
* SFTP read flags were not fully portable.

1.3.2
++++++
Expand Down
6 changes: 4 additions & 2 deletions pssh/ssh2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from ssh2.exceptions import AuthenticationError, AgentError, \
SessionHandshakeError, SFTPHandleError, SFTPIOError as SFTPIOError_ssh2
from ssh2.session import Session
from ssh2.sftp import LIBSSH2_FXF_CREAT, LIBSSH2_FXF_WRITE, \
from ssh2.sftp import LIBSSH2_FXF_READ, LIBSSH2_FXF_CREAT, LIBSSH2_FXF_WRITE, \
LIBSSH2_FXF_TRUNC, LIBSSH2_SFTP_S_IRUSR, LIBSSH2_SFTP_S_IRGRP, \
LIBSSH2_SFTP_S_IWUSR, LIBSSH2_SFTP_S_IXUSR, LIBSSH2_SFTP_S_IROTH, \
LIBSSH2_SFTP_S_IXGRP, LIBSSH2_SFTP_S_IXOTH
Expand Down Expand Up @@ -587,7 +587,9 @@ def _sftp_get(self, remote_fh, local_file):
local_fh.write(data)

def sftp_get(self, sftp, remote_file, local_file):
with self._sftp_openfh(sftp.open, remote_file, 0, 0) as remote_fh:
with self._sftp_openfh(
sftp.open, remote_file,
LIBSSH2_FXF_READ, LIBSSH2_SFTP_S_IRUSR) as remote_fh:
try:
self._sftp_get(remote_fh, local_file)
# THREAD_POOL.apply(
Expand Down

0 comments on commit b00a4da

Please sign in to comment.