SSHLibrary put_file keyword causes IOError on Ubuntu

572 views
Skip to first unread message

Samuli Silvius

unread,
Jun 6, 2014, 5:28:04 AM6/6/14
to robotframe...@googlegroups.com
Hi,

I have Ubuntu 12.04.4, python 2.7.3 and I have installed just robotframework-sshlibrary to it with commands:
  sudo apt-get install python-pip
  sudo pip install robotframework-sshlibrary

So now getting SSHLibrary version 2.0.2.

So I have _not_ installed Robot Framework itself to that machine.


When trying to move one file from this host to another host (also Ubuntu 12.04) I get following error:

    self.ssh.put_file(file_or_dir, self.REMOTE_TMP_DIR, mode)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/library.py", line 1366, in put_file
    path_separator)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/library.py", line 1416, in _run_sftp_command
    files = command(*args)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/abstractclient.py", line 463, in put_file
    path_separator)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/abstractclient.py", line 946, in put_file
    self._put_file(source, destination, mode, newline)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/abstractclient.py", line 998, in _put_file
    remote_file = self._create_remote_file(destination, mode)
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/pythonclient.py", line 140, in _create_remote_file
    remote_file = self._client.file(destination, 'wb')
  File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 245, in open
    t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 649, in _request
    return self._read_response(num)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 696, in _read_response
    self._convert_status(msg)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 726, in _convert_status
    raise IOError(text)
IOError: Failure

Target directory in target host exists and it's this:
root@cirrus:~/samuli# ll /tmp/kvmTool
total 8
drwxr-xr-x 2 root root 4096 Jun  6 12:09 ./
drwxrwxrwt 6 root root 4096 Jun  6 13:17 ../
root@cirrus:~/samuli# 

with mode I use '0777'.  And trying to move one file that exists locally.

And login to the host has been made as root user.

Any ideas?

-Samuli

Tim Alexander

unread,
Jun 6, 2014, 4:59:44 PM6/6/14
to robotframework-devel

To the list this time. Also fixed the below, said "doesn't work" and meant "does work showing the problem is in the python implementation of the same action"

On Jun 6, 2014 3:55 PM, "Tim Alexander" <dragon...@gmail.com> wrote:
>
> Dumb question that is now the second thing I check after permissions, what about disk space?
>
> Next step in troubleshooting IMHO is use SFTP proper from openssh to try moving the file out in the same way (user, group, keys, etc.) and post back here if it does work showing the problem is in the python implementation of the same action .
>
> FYI - what your seeing likely has nothing to do with sshlibrary and instead is in either ssh level or paramiko level.

>> --
>> You received this message because you are subscribed to the Google Groups "robotframework-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-d...@googlegroups.com.
>> To post to this group, send email to robotframe...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/robotframework-devel.
>> For more options, visit https://groups.google.com/d/optout.

Samuli Silvius

unread,
Jun 7, 2014, 1:50:13 AM6/7/14
to robotframe...@googlegroups.com
There are plenty of disk space so that is not the problem. And another thing I forgot to mention is that SSHLibrary's keyword put_directory works fine to transfer dir with punch of files to same remote target directory location.
How do I debug the low level SFTP implementation? Any simple example?

-Samuli

>> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-devel+unsub...@googlegroups.com.

Samuli Silvius

unread,
Jun 7, 2014, 2:23:08 AM6/7/14
to robotframe...@googlegroups.com

Hi,

I enabled ssh logging on SSHLibrary and figured out the problem. I was giving the destination directory without trailing slash "/tmp/kvmTool" and if I give it like "/tmp/kvmTool/" it works! This sounds like a bug to me if looking keyword documentation of put_file: https://robotframework-sshlibrary.googlecode.com/git-history/2.0/doc/SSHLibrary.html#Put File
 --> "2. If destination is an existing directory, source file is uploaded into it. "
But not mentioned that dir must be given with trailing slash.

-Samuli

Jussi Malinen

unread,
Jun 27, 2014, 11:34:20 AM6/27/14
to samuli....@gmail.com, robotframe...@googlegroups.com
Damn!

Could you make an issue about this to the issue tracker?

I hope to have some time to go through all the issues in SSHLibrary and to make a new release “soon”. (We are very busy in the core team right now..)

- Jussi
> >> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-d...@googlegroups.com.
> >> To post to this group, send email to robotframe...@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/robotframework-devel.
> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "robotframework-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-d...@googlegroups.com.

Samuli Silvius

unread,
Jun 27, 2014, 1:36:49 PM6/27/14
to Jussi Malinen, robotframe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages