communicators/ssh: throttle warnings [GH-3442]
This commit is contained in:
parent
32fe18381f
commit
ad8d133293
|
@ -20,8 +20,8 @@ BUG FIXES:
|
||||||
- commands/package: Nice error if includes contain symlinks. [GH-3200]
|
- commands/package: Nice error if includes contain symlinks. [GH-3200]
|
||||||
- commands/rsync-auto: Don't crash if the machine can't be communicated
|
- commands/rsync-auto: Don't crash if the machine can't be communicated
|
||||||
to. [GH-3419]
|
to. [GH-3419]
|
||||||
- communicators/ssh: Only show connection warnings after three connection
|
- communicators/ssh: Throttle connection attempt warnings if the warnings
|
||||||
attempt failures. [GH-3442]
|
are the same. [GH-3442]
|
||||||
- guests/coreos: Docker provisioner works. [GH-3425]
|
- guests/coreos: Docker provisioner works. [GH-3425]
|
||||||
- guests/fedora: Fix hostname setting. [GH-3382]
|
- guests/fedora: Fix hostname setting. [GH-3382]
|
||||||
- guests/fedora: Support predictable network interface names for
|
- guests/fedora: Support predictable network interface names for
|
||||||
|
|
|
@ -52,9 +52,9 @@ module VagrantPlugins
|
||||||
ssh_auth_type = "password" if ssh_info[:password]
|
ssh_auth_type = "password" if ssh_info[:password]
|
||||||
@machine.ui.detail("SSH auth method: #{ssh_auth_type}")
|
@machine.ui.detail("SSH auth method: #{ssh_auth_type}")
|
||||||
|
|
||||||
attempts = 0
|
last_message = nil
|
||||||
|
last_message_repeat_at = 0
|
||||||
while true
|
while true
|
||||||
attempts +=1
|
|
||||||
message = nil
|
message = nil
|
||||||
begin
|
begin
|
||||||
begin
|
begin
|
||||||
|
@ -84,10 +84,21 @@ module VagrantPlugins
|
||||||
# Ignore it, SSH is not ready, some other error.
|
# Ignore it, SSH is not ready, some other error.
|
||||||
end
|
end
|
||||||
|
|
||||||
# Start showing warning messages after the 3rd attempt, since
|
# If we have a message to show, then show it. We don't show
|
||||||
# the first couple are usually just waiting for actual booting.
|
# repeated messages unless they've been repeating longer than
|
||||||
if message && attempts >= 3
|
# 10 seconds.
|
||||||
@machine.ui.detail("Warning: #{message} Retrying...")
|
if message
|
||||||
|
message_at = Time.now.to_f
|
||||||
|
show_message = true
|
||||||
|
if last_message == message
|
||||||
|
show_message = (message_at - last_message_repeat_at) > 10.0
|
||||||
|
end
|
||||||
|
|
||||||
|
if show_message
|
||||||
|
@machine.ui.detail("Warning: #{message} Retrying...")
|
||||||
|
last_message = message
|
||||||
|
last_message_repeat_at = message_at
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue