Skip to content

Commit 6ff45ee

Browse files
author
Kincaid Savoie
committed
Fixed messy merge.
1 parent b912576 commit 6ff45ee

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pssh/ssh_client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,19 @@ def copy_file(self, local_file, remote_file, recurse=False):
311311
return self._copy_dir(local_file, remote_file)
312312
sftp = self._make_sftp()
313313
destination = [_dir for _dir in remote_file.split(os.path.sep)
314-
if _dir][:-1]
314+
if _dir][:-1][0]
315315
if remote_file.startswith(os.path.sep):
316-
destination[0] = os.path.sep + destination[0]
317-
# import ipdb; ipdb.set_trace()
316+
destination = os.path.sep + destination
318317
try:
319-
sftp.stat(destination[0])
318+
sftp.stat(destination)
320319
except IOError:
321-
self.mkdir(sftp, destination[0])
320+
self.mkdir(sftp, destination)
321+
sftp.chdir()
322322
try:
323323
sftp.put(local_file, remote_file)
324324
except Exception, error:
325325
logger.error("Error occured copying file %s to remote destination %s:%s - %s",
326326
local_file, self.host, remote_file, error)
327+
else:
328+
logger.info("Copied local file %s to remote destination %s:%s",
329+
local_file, self.host, remote_file)

0 commit comments

Comments
 (0)