Skip to content

Commit

Permalink
Fix for multiple vm's started by worker (#637)
Browse files Browse the repository at this point in the history
* Fix for multiple vm's started by worker

* Update ec2.go

* Update ec2.go

* Update ec2.go

Fix indentation

Co-authored-by: Pavel Dotsulenko <[email protected]>
  • Loading branch information
r-arek and pavel-d authored Aug 28, 2020
1 parent 34b84b7 commit d4237c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ func (p *ec2Provider) Start(ctx gocontext.Context, startAttributes *StartAttribu
}

instances, lastErr = svc.DescribeInstances(describeInstancesInput)
if instances != nil {
if instances != nil && len(instances.Reservations) > 0 && len(instances.Reservations[0].Instances) > 0 {
instance := instances.Reservations[0].Instances[0]
address := *instance.PrivateIpAddress
if instance.PublicIpAddress != nil && p.publicIPConnect {
Expand All @@ -523,6 +523,9 @@ func (p *ec2Provider) Start(ctx gocontext.Context, startAttributes *StartAttribu
instanceChan <- nil
return
}
if reservation.Instances[0].InstanceId != nil {
logger.Debugf("instance %s is not ready", *reservation.Instances[0].InstanceId)
}
time.Sleep(500 * time.Millisecond)
}
}()
Expand Down

0 comments on commit d4237c9

Please sign in to comment.