From 747dd9301b2aaf89b411b1e398eada99344ad794 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 12 Nov 2018 15:33:19 -0800 Subject: [PATCH] Add reset! to ssh communicator. Reduce number of ssh info prints. --- plugins/communicators/ssh/communicator.rb | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index deb241144..e9b0cce8f 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -69,11 +69,14 @@ module VagrantPlugins end # Got it! Let the user know what we're connecting to. - @machine.ui.detail("SSH address: #{ssh_info[:host]}:#{ssh_info[:port]}") - @machine.ui.detail("SSH username: #{ssh_info[:username]}") - ssh_auth_type = "private key" - ssh_auth_type = "password" if ssh_info[:password] - @machine.ui.detail("SSH auth method: #{ssh_auth_type}") + if !@ssh_info_notification + @machine.ui.detail("SSH address: #{ssh_info[:host]}:#{ssh_info[:port]}") + @machine.ui.detail("SSH username: #{ssh_info[:username]}") + ssh_auth_type = "private key" + ssh_auth_type = "password" if ssh_info[:password] + @machine.ui.detail("SSH auth method: #{ssh_auth_type}") + @ssh_info_notification = true + end previous_messages = {} while true @@ -309,6 +312,15 @@ module VagrantPlugins to: to.to_s end + def reset! + if @connection + @connection.close + @connection = nil + end + @ssh_info_notification = true # suppress ssh info output + wait_for_ready(5) + end + protected # Opens an SSH connection and yields it to a block.