starcluster.scp.SCPClient

Package starcluster :: Module scp :: Class SCPClient |
[hide private]
[frames] | no frames]

# Class SCPClient

source code

An scp1 implementation, compatible with openssh scp. Raises SCPException for all transport related errors. Local filesystem and OS errors pass through.

Main public methods are .put and .get The get method is controlled by the remote scp instance, and behaves accordingly. This means that symlinks are resolved, and the transfer is halted after too many levels of symlinks are detected. The put method uses os.walk for recursion, and sends files accordingly. Since scp doesn't support symlinks, we send file symlinks as the file (matching scp behaviour), but we make no attempt at symlinked directories.

Instance Methods | [hide private]
__init__(self, transport, buff_size=16384, socket_timeout=5.0, progress=None) Create an scp1 client. | source code
put(self, files, remote_path=`'``.``'`, recursive=False, preserve_times=False) Transfer files to remote host. | source code
get(self, remote_path, local_path=`'````'`, recursive=False, preserve_times=False) Transfer files from remote host to localhost | source code
_read_stats(self, name) return just the file stats needed for scp | source code
_send_files(self, files) | source code
_send_recursive(self, files) | source code
_send_pushd(self, directory) | source code
_send_popd(self) | source code
_send_time(self, mtime, atime) | source code
_recv_confirm(self) | source code
_recv_all(self) | source code
_set_time(self, cmd) | source code
_recv_file(self, cmd) | source code
_recv_pushd(self, cmd) | source code
_recv_popd(self, *cmd) | source code
_set_dirtimes(self) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, transport, buff_size=16384, socket_timeout=5.0, progress=None) (Constructor) | source code
Create an scp1 client. Parameters: `transport` (`Transport`) - an existing paramiko `Transport` `buff_size` (int) - size of the scp send buffer. `socket_timeout` (float) - channel socket timeout in seconds `progress` (function(string, int, int)) - callback - called with (filename, size, sent) during transfers Overrides: object.__init__

### put(self, files, remote_path=`'``.``'`, recursive=False, preserve_times=False) | source code
Transfer files to remote host. Parameters: `files` (string OR list of strings) - A single path, or a list of paths to be transfered. recursive must be True to transfer directories. `remote_path` (str) - path in which to receive the files on the remote host. defaults to '.' `recursive` (bool) - transfer files and directories recursively `preserve_times` (bool) - preserve mtime and atime of transfered files and directories.

### get(self, remote_path, local_path=`'````'`, recursive=False, preserve_times=False) | source code
Transfer files from remote host to localhost Parameters: `remote_path` (str) - path to retreive from remote host. since this is evaluated by scp on the remote host, shell wildcards and environment variables may be used. `local_path` (str) - path in which to receive files locally `recursive` (bool) - transfer files and directories recursively `preserve_times` (bool) - preserve mtime and atime of transfered files and directories.