scaleway / scaleway-cli

Command Line Interface for Scaleway

Home Page:https://www.scaleway.com/en/cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scw logs failes with bash error on Windows

Hades32 opened this issue · comments

OS: Windows 10
Shell: Msys2, Part of Git 2.7.0.windows.1
Logged in with token and organisation.
Image: Docker 1.10

marti@WIN-SJ0A7GO32DV /d/Temp
$ scw logs 14a75140-43df-4cdf-b1db-586042aacbac
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file
time="2016-04-06T23:38:27+02:00" level=fatal msg="cannot execute 'logs': command execution failed: exit status 1"

SCW Version 1.9

This is certainly due to the way we are handling remote command executions on Windows.

Can you run scw -D logs 14a75140-43df-4cdf-b1db-586042aacbac (with debug), you should get the command we try to run, something like ssh 1.2.3.4 /bin/sh -c dmesg

Then can you try to run this command manually from your shell and paste us here the result of these two commands ?


@QuentinPerez, I think we should bullet-proof the utils.SSHExec() function for Windows

$ scw -D logs 01188db2-a70d-4aa8-a4d6-aa246e1a32bf
time="2016-04-07T23:01:15+02:00" level=debug msg="curl -X GET -H \"Content-Type: application/json\" -H \"User-Agent: scw/v1.9.0\" -H \"X-Auth-Token: 00000000-0000-1000-0000-000000000000\" https://api.scaleway.com/servers"
time="2016-04-07T23:01:15+02:00" level=debug msg="curl -X GET -H \"Content-Type: application/json\" -H \"User-Agent: scw/v1.9.0\" -H \"X-Auth-Token: 00000000-0000-1000-0000-000000000000\" https://api.scaleway.com/servers/01188db2-a70d-4aa8-a4d6-aa246e1a32bf"
time="2016-04-07T23:01:16+02:00" level=debug msg="Executing: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c \"\\\"dmesg\\\"\""
Warning: Permanently added '163.172.142.208' (ECDSA) to the list of known hosts.
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file
Connection to 163.172.142.208 closed.
time="2016-04-07T23:01:19+02:00" level=fatal msg="cannot execute 'logs': command execution failed: exit status 1"

Can you try to run the four following commands and tell us if any of these succeed:

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "\"dmesg\""

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "dmesg"

ssh -o UserKnownHostsFile=NUL -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "\"dmesg\""

ssh -o UserKnownHostsFile=NUL -o StrictHostKeyChecking=no -l root 163.172.142.208 -t -t -- /bin/sh -e -c "dmesg"

I think we have a least a bad path on windows: /dev/null should be NUL, I also have a doubt about the double-escaping

All four work. /dev/null is expected to work from Bash and I think ssh.exe has special handling for it.

works fine now