-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Labels
Description
Hi, according to a doc copy_file should be able to create missing folder
Remote directories in remote_file that do not exist will be created as long as permissions allow.
I don't see this is happening. I used same credentials for python script as default ssh client
to verify I can create folder manually on remote.
this is output from the pssh:
Error occured copying file 1 to remote destination mysuperhost:/mnt/cache/purge_requests/1 - >[Errno 2] No such file
local file also exists, and copy_file succeeded with hosts which have remote folder already created.
would be nice to add some exception for that case.
This is the code I'm using right now:
output = ssh_client.copy_file(src, dst)
ssh_client.pool.join()
for cmd in output:
try:
cmd_out = cmd.get()
print 'upload result ', cmd.exception
except (ConnectionErrorException, AuthenticationException,\
UnknownHostException, SSHException ) as e:
print("Unexpected error:{} in host {}".format(e, e.args[1]))
print "*** removing errorneous hostname from list ", e.args[1]
ssh_client.hosts.remove(e.args[1])
except Exception as e:
print 'upload exception ', str(e)
ssh_client.hosts.remove(e.args[1])