Change proxy_command to use embedded OpenSSH functionality instead of (#1222)

Solves vagrant not detecting end of ssh connection when a proxy is
used, described in #921

Allows ssh argument population to append arguments only when
respective values are not nil, avoiding creation of invalid
proxy_command when ssh-agent or ssh config based connections are used
This commit is contained in:
Darragh Bailey
2021-03-17 12:19:02 +00:00
committed by GitHub
parent c8c590f586
commit ba4235add9

View File

@@ -69,12 +69,11 @@ module VagrantPlugins
} }
if @machine.provider_config.connect_via_ssh if @machine.provider_config.connect_via_ssh
ssh_info[:proxy_command] = proxy_command = "ssh '#{@machine.provider_config.host}' "
"ssh '#{@machine.provider_config.host}' " \ proxy_command << "-l '#{@machine.provider_config.username}' " if @machine.provider_config.username
"-l '#{@machine.provider_config.username}' " \ proxy_command << "-i '#{@machine.provider_config.id_ssh_key_file}' " if @machine.provider_config.id_ssh_key_file
"-i '#{@machine.provider_config.id_ssh_key_file}' " \ proxy_command << '-W %h:%p'
'nc %h %p' ssh_info[:proxy_command] = proxy_command
end end
ssh_info ssh_info