func (c *GenericClient) WaitForInstanceStatus(d *Driver, status string) error { return utils.WaitForSpecificOrError(func() (bool, error) { current, err := servers.Get(c.Compute, d.MachineId).Extract() if err != nil { return true, err } if current.Status == "ERROR" { return true, fmt.Errorf("Instance creation failed. Instance is in ERROR state") } if current.Status == status { return true, nil } return false, nil }, 50, 4*time.Second) }
func (d *Driver) waitForJob(client *egoscale.Client, jobid string) error { log.Infof("Waiting for job to complete...") return utils.WaitForSpecificOrError(func() (bool, error) { return d.jobIsDone(client, jobid) }, 60, 2*time.Second) }