func (i *EC2IaaS) waitForDnsName(ec2Inst *ec2.EC2, instance *ec2.Instance) (*ec2.Instance, error) { rawWait, _ := i.base.GetConfigString("wait-timeout") maxWaitTime, _ := strconv.Atoi(rawWait) if maxWaitTime == 0 { maxWaitTime = 300 } q, err := queue.Queue() if err != nil { return nil, err } taskName := fmt.Sprintf("ec2-wait-machine-%s", i.base.IaaSName) waitDuration := time.Duration(maxWaitTime) * time.Second job, err := q.EnqueueWait(taskName, monsterqueue.JobParams{ "region": ec2Inst.Config.Region, "endpoint": ec2Inst.Config.Endpoint, "machineId": *instance.InstanceID, "timeout": maxWaitTime, }, waitDuration) if err != nil { if err == monsterqueue.ErrQueueWaitTimeout { return nil, fmt.Errorf("ec2: time out after %v waiting for instance %s to start", waitDuration, *instance.InstanceID) } return nil, err } result, err := job.Result() if err != nil { return nil, err } instance.PublicDNSName = aws.String(result.(string)) return instance, nil }