This modules contains some wrappers over the ssh paramiko library to provide handling functions on remote hosts through ssh.
Main classes are:
- RemotePath: this class use an ssh/sftp connection to mimic the
- functions in utils.path but remotely and provides basic file transfer
This class will server as a Wrapper to the paramiko sftp protocol througth a ssh connection. This class will implement useful methods for remote path handling such as: creating files, deleting folders…
Same as pyworkflow.utils.path.cleanPath but for remote folders or files.
Close both ssh and sftp connections.
Same as shutil.copytree, but allowing that the dest folder also exists. dest is a remote folder.
Check if a remote path exists(like os.path.exists remotely).
fromCredentials(hostName, userName, password, port=22, **args)¶
Wrapper around sftp.get that ensures path exists for localFile.
Check if a remote path is a directory (like os.path.isdir remotely).
Create the remote folder path for remoteFiles.
Make all path in remoteFolders list.
Like os.makedirs remotely.
Wrapper around sftp.put that ensures the remote path exists for put the file.
sshConnect(hostName, userName, password, port=22, **args)¶
Common way to create a ssh connection. Params:hostName: Remote host name. userName: User name. password: Password. port: port to establish connection (usually 22)
Returns: ssh connection handler.
Establish a connection receiving a HostConfig class.
Test the connection to a remote host give its configuration.(see HostConfig class) Params:host: configuration of the remote host, should contains hostName, userName and password.
Returns: True if the host could be reached.