datalad_next.patches.sshconnector

Provide proper arguments for scp-command calls in SSHConnection

The original code has errors in the methods BaseSSHConnection.put BaseSSHConnection.get. Both methods use self.sshri.hostname to determine the target for an scp-command. They should instead use self.sshri.as_str() in order to include a user specification into the target.

The changes in this patch use self.sshri.as_str() to provide the correct targets for scp-commands.

datalad_next.patches.sshconnector.BaseSSHConnection_get(self, source, destination, recursive=False, preserve_attrs=False)[source]

Copies source file/folder from remote to a local destination.

Note: this method performs escaping of filenames to an extent that moderately weird ones should work (spaces, quotes, pipes, other characters with special shell meaning), but more complicated cases might require appropriate external preprocessing of filenames.

Parameters:
  • source (str or list) -- file/folder path(s) to copy from the remote host

  • destination (str) -- file/folder path to copy to on the local host

  • recursive (bool) -- flag to enable recursive copying of given sources

  • preserve_attrs (bool) -- preserve modification times, access times, and modes from the original file

Returns:

stdout, stderr of the copy operation.

Return type:

str

datalad_next.patches.sshconnector.BaseSSHConnection_put(self, source, destination, recursive=False, preserve_attrs=False)[source]

Copies source file/folder to destination on the remote.

Note: this method performs escaping of filenames to an extent that moderately weird ones should work (spaces, quotes, pipes, other characters with special shell meaning), but more complicated cases might require appropriate external preprocessing of filenames.

Parameters:
  • source (str or list) -- file/folder path(s) to copy from on local

  • destination (str) -- file/folder path to copy to on remote

  • recursive (bool) -- flag to enable recursive copying of given sources

  • preserve_attrs (bool) -- preserve modification times, access times, and modes from the original file

Returns:

stdout, stderr of the copy operation.

Return type:

str