communicators/ssh: cache ssh_info

This lowers the number of subprocesses with VirtualBox quite a bit.
This commit is contained in:
Mitchell Hashimoto 2014-02-13 20:34:51 -08:00
parent d2d96a0726
commit 14b27ae215
1 changed files with 3 additions and 2 deletions

View File

@ -306,7 +306,8 @@ module VagrantPlugins
raise Vagrant::Errors::SSHKeyTypeNotSupported raise Vagrant::Errors::SSHKeyTypeNotSupported
end end
@connection = connection @connection = connection
@connection_ssh_info = ssh_info
# Yield the connection that is ready to be used and # Yield the connection that is ready to be used and
# return the value of the block # return the value of the block
@ -368,7 +369,7 @@ module VagrantPlugins
# Set SSH_AUTH_SOCK if we are in sudo and forwarding agent. # Set SSH_AUTH_SOCK if we are in sudo and forwarding agent.
# This is to work around often misconfigured boxes where # This is to work around often misconfigured boxes where
# the SSH_AUTH_SOCK env var is not preserved. # the SSH_AUTH_SOCK env var is not preserved.
if @machine.ssh_info[:forward_agent] && sudo if @connection_ssh_info[:forward_agent] && sudo
auth_socket = "" auth_socket = ""
execute("echo; printf $SSH_AUTH_SOCK") do |type, data| execute("echo; printf $SSH_AUTH_SOCK") do |type, data|
if type == :stdout if type == :stdout