check for ip after timeout (#9748)
This commit is contained in:
parent
9d453624ff
commit
e475db6a66
|
@ -97,10 +97,16 @@ func (s *StepWaitForIp) Run(ctx context.Context, state multistep.StateBag) multi
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-timeout:
|
case <-timeout:
|
||||||
|
cancel()
|
||||||
|
<-waitDone
|
||||||
|
if ip != "" {
|
||||||
|
state.Put("ip", ip)
|
||||||
|
log.Printf("[WARN] API timeout waiting for IP but one IP was found. Using IP: %s", ip)
|
||||||
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
err := fmt.Errorf("Timeout waiting for IP.")
|
err := fmt.Errorf("Timeout waiting for IP.")
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
cancel()
|
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
cancel()
|
cancel()
|
||||||
|
@ -144,7 +150,7 @@ loop:
|
||||||
// Check for ctx cancellation to avoid printing any IP logs at the timeout
|
// Check for ctx cancellation to avoid printing any IP logs at the timeout
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return "", fmt.Errorf("IP wait cancelled")
|
return ip, fmt.Errorf("IP wait cancelled.")
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue