Add reset! to ssh communicator. Reduce number of ssh info prints.

This commit is contained in:
Chris Roberts 2018-11-12 15:33:19 -08:00
parent cfc3e9e398
commit 747dd9301b
1 changed files with 17 additions and 5 deletions

View File

@ -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.