예제 #1
0
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
		}
	}
}
예제 #2
0
파일: wait.go 프로젝트: srenkens/convoy
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
	})
}