ParallelSSH / parallel-ssh

Asynchronous parallel SSH client library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
1.2k stars 148 forks source link

Add sftp=None support for creating SFTP channel to SSHClient.mkdir() #394

Open snooter101 opened 2 months ago

snooter101 commented 2 months ago

Is your feature request related to a problem? Please describe. First try at using parallel-ssh and am trying to create a remote directory using SSHClient.mkdir().

The method requires the sftp parameter and doesn't allow None, while other similar methods (e.g. SSHClient.copy_file()) do.

I looked at the source and worked out what I needed to do (i.e. use the internal method _make_sftp()), but it would be nicer for it to be created on the fly.

Describe the solution you'd like Default sftp=None for SSHClient.mkdir(), and when sftp=None, then use _make_sftp() to create the SFTP channel.

I realise this changes the API so might be something that needs to be changed in a later version. Also, adding the same default sftp handling to other methods like sftp_get() and sftp_put() would simplify usage as well.

Describe alternatives you've considered Used internal method to create SFTP channel.

Additional context None.