jbardin / scp.py

scp module for paramiko
Other
534 stars 137 forks source link

SCP of file to Cisco Device fails in 0.7.0 #20

Closed g-phillips closed 10 years ago

g-phillips commented 10 years ago

SCP'ing single file to Cisco Device fails in 0.7.0 but working fine in 0.5.1.

Error is: No such file or directory.

jbardin commented 10 years ago

Can you show an example of exactly how you're sending the file? The remote command for a single file hasn't changed.

g-phillips commented 10 years ago

Exact same method as below works in 0.5.1.

import paramiko import scp

ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

sf = 'test.txt' df = 'sup-bootdisk:/test.txt'

ssh_client.connect(hostname, username=username, password=password, allow_agent=False) scp_client = scp.SCPClient(ssh_client.get_transport()) scp_client.put(sf, df) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/scp.py", line 77, in put self._recv_confirm() File "/usr/local/lib/python2.7/dist-packages/scp.py", line 232, in _recv_confirm raise SCPException(msg[1:]) scp.SCPException: scp: 'sup-bootdisk:/test.txt': No such file or directory

jbardin commented 10 years ago

It's been a long time since I used Cisco devices; I assume sup-bootdisk:/ refers to a device?

The scp command is looking for a directory named sup-bootdisk: in the current directory. I was quoting more than I had to just to be safe, but I'll have to do some tests to make sure removing the quotes doesn't cause any other regressions.

jbardin commented 10 years ago

The problem was the _sh_quote regex.

You can pull from master if you want to get it now. I'll make a new release shortly.