From 14b27ae215c0ed6ed19f94912f8ee86ec02ac5c4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 13 Feb 2014 20:34:51 -0800 Subject: [PATCH] communicators/ssh: cache ssh_info This lowers the number of subprocesses with VirtualBox quite a bit. --- plugins/communicators/ssh/communicator.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index 79fc39e63..713349b33 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -306,7 +306,8 @@ module VagrantPlugins raise Vagrant::Errors::SSHKeyTypeNotSupported end - @connection = connection + @connection = connection + @connection_ssh_info = ssh_info # Yield the connection that is ready to be used and # return the value of the block @@ -368,7 +369,7 @@ module VagrantPlugins # Set SSH_AUTH_SOCK if we are in sudo and forwarding agent. # This is to work around often misconfigured boxes where # 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 = "" execute("echo; printf $SSH_AUTH_SOCK") do |type, data| if type == :stdout