amazon/common: sleep 3 seconds if instance doesn't exist

This commit is contained in:
Mitchell Hashimoto 2015-05-27 20:15:07 -07:00
parent f78d7eefdc
commit c78c4e78ad
1 changed files with 3 additions and 2 deletions

View File

@ -195,13 +195,14 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
instanceId = spotResp.SpotRequestResults[0].InstanceId
}
var instanceResp, instanceErr = ec2conn.Instances([]string{instanceId}, nil)
instanceResp, instanceErr := ec2conn.Instances([]string{instanceId}, nil)
for i := 0; i < 10; i++ {
if instanceErr == nil {
err = instanceErr
break
}
time.Sleep(time.Duration(3))
time.Sleep(3 * time.Second)
instanceResp, err = ec2conn.Instances([]string{instanceId}, nil)
}