func waitTransition(cl *client.RancherClient, acc *client.Account) {
	newAcc := &client.Account{}
	for {
		cl.Reload(&acc.Resource, newAcc)
		if newAcc.Transitioning == "error" {
			log.Fatalf("Error creating new account, err = [%v]", newAcc.TransitioningMessage)
		}
		if newAcc.Transitioning == "no" {
			return
		}
	}
}
Beispiel #2
0
func WaitFor(client *rancherClient.RancherClient, resource *rancherClient.Resource, output interface{}, transitioning func() string) error {
	return Backoff(5*time.Minute, fmt.Sprintf("Failed waiting for %s:%s", resource.Type, resource.Id), func() (bool, error) {
		err := client.Reload(resource, output)
		if err != nil {
			return false, err
		}
		if transitioning() != "yes" {
			return true, nil
		}
		return false, nil
	})
}