diff --git a/CHANGELOG.md b/CHANGELOG.md index 013e757ec..335e804e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ BUG FIXES: - commands/package: Nice error if includes contain symlinks. [GH-3200] - commands/rsync-auto: Don't crash if the machine can't be communicated to. [GH-3419] + - communicators/ssh: Only show connection warnings after three connection + attempt failures. [GH-3442] - guests/coreos: Docker provisioner works. [GH-3425] - guests/fedora: Fix hostname setting. [GH-3382] - guests/fedora: Support predictable network interface names for diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index f9c76c4f6..fb9789bea 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -52,8 +52,10 @@ module VagrantPlugins ssh_auth_type = "password" if ssh_info[:password] @machine.ui.detail("SSH auth method: #{ssh_auth_type}") + attempts = 0 while true - message = nil + attempts +=1 + message = nil begin begin connect(retries: 1) @@ -82,7 +84,9 @@ module VagrantPlugins # Ignore it, SSH is not ready, some other error. end - if message + # Start showing warning messages after the 3rd attempt, since + # the first couple are usually just waiting for actual booting. + if message && attempts >= 3 @machine.ui.detail("Warning: #{message} Retrying...") end end