https://pulumi.com logo
b

broad-lifeguard-10744

05/30/2023, 3:05 PM
Hi, I'm interested in recent launch of Pulumi commands provider. However, I'm unable to understand few concepts on it from the Docs. Mainly on the purpose of create and delete and whether it is possible to execute custom commands like ls, cat etc. on the created resource (mostly the VM). Can someone help me out
m

melodic-tomato-39005

05/30/2023, 3:25 PM
Hi @broad-lifeguard-10744, these things are indeed possible. Does this example help you, mainly the
remote
and
local
commands from line 51?
b

broad-lifeguard-10744

05/30/2023, 3:49 PM
@melodic-tomato-39005 Thanks for your reply. I was able to browse through the Internet and find some examples in Python (since I'm much familiar in that). However, I'm hitting with a SSH Handshake problem that I can't figure out how to solve.
vm_connection = command.remote.ConnectionArgs( host="x.x.x.x", user="saran", password="1Failure" ) command.remote.Command("check-cloud-init-setup", connection=vm_connection, create="until grep -q \"The system is finally up\" /var/log/cloud-init-output.log; do sleep 1;done" )
This is the sample remote commands setup I'm running in Python. I'm able to connect to this VM from my machine through CLI SSH, however the remote commands failing with the error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain
I also copied my ssh public key inside the VM, but still no success
From whatever, I researched the remote commands should attempt to connect through publickey setup. But why does my attempted methods list only 'none' ?
BTW I'm using :
Copy code
pulumi : 3.6.8
Copy code
pulumi_command: 0.7.2
m

melodic-tomato-39005

05/30/2023, 4:00 PM
Did you configure your EC2 instance with the matching
keyName
and did you configure the Pulumi
connection
like in the example?
b

broad-lifeguard-10744

05/30/2023, 4:02 PM
I'm sorry, I should have informed this. I'm trying to connect to a local Ubuntu VM created through pulumi libvirt in Python. The connection arguments are created with the
command.remote.ConnectionArgs
as I sent to you previously.
As I told, I have no problem SSH into that VM from my server CLI, and since I've moved by public key also to the authorized list in the VM, it's not asking for password when I SSH through CLI. However,
command.remote.Command
is failing with Handshake error
m

melodic-tomato-39005

05/30/2023, 4:12 PM
Pulumi won’t attempt to use the key because the connection is only configured to use a password (the one you pasted above). I’m not sure why the password wouldn’t work, though.
b

broad-lifeguard-10744

05/30/2023, 4:55 PM
So, the attempted methods has only none because I haven't supplied the private key of my server in my connection.
Yes, that's even I thought when supplying the password. Is there any way to debug the Pulumi remote APIs to see what's happening
m

melodic-tomato-39005

05/30/2023, 4:58 PM
You could enable verbose logging as described here.
b

broad-lifeguard-10744

05/30/2023, 5:12 PM
Thanks for troubleshooting guide @melodic-tomato-39005. PFA the pulumi up for the above remote command in -v=9 verbose.
m

melodic-tomato-39005

05/30/2023, 9:57 PM
These logs confirm that SSH auth is not even attempted but don’t say why. Would you mind opening an issue at https://github.com/pulumi/pulumi-command/issues?
b

broad-lifeguard-10744

06/03/2023, 2:54 PM
@melodic-tomato-39005 Sorry for the delay in response. I've fixed the issue. The problem was with the default SSH configuration that comes with Ubuntu cloud image.
The config had
PasswordAuthentication
and
PubkeyAuthentication
as NO. This is why the Remote Command SSH was failing. Once I fixed this, it started working.