datalad_next.patches.replace_sshremoteio
Provide a full replacement of SSHRemoteIO
First and foremost, this replacement no longer uses the remote shell implementation of the previous version, but is based on datalad_next.shell.
Moreover, the cmd
-argument for the shell ssh-process, is not correct, if
self.ssh
is an instance of NoMultiplexSSHConnection
.
The changes in this patch build the correct cmd
-argument by adding
additional arguments to cmd
, if self.ssh is an instance of
NoMultiplexSSHConnection
. More precisely, the arguments that are
required to open a "shell" in a NoMultiplexSSHConnection
are stored in
NoMultiplexSSHConnection._ssh_open_args
and not in
NoMultiplexSSHConnection._ssh_args
. This patch therefore provides
arguments from both lists, i.e. from _ssh_args
and _ssh_open_args
in
the call that opens a "shell", if self.ssh
is an instance of
NoMultiplexSSHConnection
.
The implementation also no longer assumes that local and remote platform are identical. This patch introduces an actual remote platform/system determination.
This patch also adds the method url2transport_path()
, which is used to
convert abstract paths, which are used in the patched RIA/ORA-code, into paths
that SSHRemoteIO can operate on.
- class datalad_next.patches.replace_sshremoteio.SSHRemoteIO(ssh_url, buffer_size=65536)[source]
Bases:
IOBase
IO operation if the object tree is SSH-accessible
It doesn't even think about a windows server.
- ensure_writeable(path)[source]
Context manager to get write permission on path and restore original mode afterwards.
If git-annex ever touched the key store, the keys will be in mode 444 directories, and we need to obtain permission first.
- Parameters:
path (Path) -- path to the target file
- get_from_archive(archive, src, dst, progress_cb)[source]
Get a file from an archive
- Parameters:
archive_path (Path or str) -- Must be an absolute path and point to an existing supported archive
file_path (Path or str) -- Must be a relative Path (relative to the root of the archive)
- in_archive(archive_path, file_path)[source]
Test whether a file is in an archive
- Parameters:
archive_path (Path or str) -- Must be an absolute path and point to an existing supported archive
file_path (Path or str) -- Must be a relative Path (relative to the root of the archive)
- read_file(file_path)[source]
Read a remote file's content
- Parameters:
file_path (Path or str) -- Must be an absolute path
- Return type:
string
- property remote_system