core: exec with the proxy command if specified

This commit is contained in:
Mitchell Hashimoto 2013-09-04 17:23:43 -07:00
parent 5c64fa3d10
commit 4c35f6d071
4 changed files with 16 additions and 7 deletions

View File

@ -281,7 +281,7 @@ module Vagrant
info[:forward_agent] = @config.ssh.forward_agent info[:forward_agent] = @config.ssh.forward_agent
info[:forward_x11] = @config.ssh.forward_x11 info[:forward_x11] = @config.ssh.forward_x11
# add in provided proxy command config # Add in provided proxy command config
info[:proxy_command] = @config.ssh.proxy_command if @config.ssh.proxy_command info[:proxy_command] = @config.ssh.proxy_command if @config.ssh.proxy_command
# Set the private key path. If a specific private key is given in # Set the private key path. If a specific private key is given in

View File

@ -122,6 +122,10 @@ module Vagrant
"-o", "ForwardX11Trusted=yes"] "-o", "ForwardX11Trusted=yes"]
end end
if ssh_info[:proxy_command]
command_options += ["-o", "ProxyCommand=#{ssh_info[:proxy_command]}"]
end
# Configurables -- extra_args should always be last due to the way the # Configurables -- extra_args should always be last due to the way the
# ssh args parser works. e.g. if the user wants to use the -t option, # ssh args parser works. e.g. if the user wants to use the -t option,
# any shell command(s) she'd like to run on the remote server would # any shell command(s) she'd like to run on the remote server would

View File

@ -209,7 +209,10 @@ module VagrantPlugins
:logger => ssh_logger, :logger => ssh_logger,
:verbose => :debug :verbose => :debug
}) })
connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command]) if ssh_info[:proxy_command]
if ssh_info[:proxy_command]
connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command])
end
@logger.info("Attempting to connect to SSH...") @logger.info("Attempting to connect to SSH...")
@logger.info(" - Host: #{ssh_info[:host]}") @logger.info(" - Host: #{ssh_info[:host]}")

View File

@ -21,6 +21,7 @@ module VagrantPlugins
@forward_x11 = UNSET_VALUE @forward_x11 = UNSET_VALUE
@guest_port = UNSET_VALUE @guest_port = UNSET_VALUE
@keep_alive = UNSET_VALUE @keep_alive = UNSET_VALUE
@proxy_command = UNSET_VALUE
@shell = UNSET_VALUE @shell = UNSET_VALUE
@default = SSHConnectConfig.new @default = SSHConnectConfig.new
@ -40,6 +41,7 @@ module VagrantPlugins
@forward_x11 = false if @forward_x11 == UNSET_VALUE @forward_x11 = false if @forward_x11 == UNSET_VALUE
@guest_port = nil if @guest_port == UNSET_VALUE @guest_port = nil if @guest_port == UNSET_VALUE
@keep_alive = false if @keep_alive == UNSET_VALUE @keep_alive = false if @keep_alive == UNSET_VALUE
@proxy_command = nil if @proxy_command == UNSET_VALUE
@shell = nil if @shell == UNSET_VALUE @shell = nil if @shell == UNSET_VALUE
@default.finalize! @default.finalize!