Commit c78c4e78 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

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

parent f78d7eef
...@@ -195,13 +195,14 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi ...@@ -195,13 +195,14 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
instanceId = spotResp.SpotRequestResults[0].InstanceId 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++ { for i := 0; i < 10; i++ {
if instanceErr == nil { if instanceErr == nil {
err = instanceErr err = instanceErr
break break
} }
time.Sleep(time.Duration(3))
time.Sleep(3 * time.Second)
instanceResp, err = ec2conn.Instances([]string{instanceId}, nil) instanceResp, err = ec2conn.Instances([]string{instanceId}, nil)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment