예제 #1
0
func getCredentials(controller clients.Controller) (clients.TenantCredentials, error) {

	for {
		creds, err := controller.GetCredentials()
		if err != nil {
			if isRetryable(err) {
				time.Sleep(time.Second * 5)
				continue
			} else {
				return creds, err
			}
		}

		return creds, err
	}
}
예제 #2
0
func registerWithProxy(controller clients.Controller, confNotValidErr error) error {
	if confNotValidErr != nil {
		// Config not valid, can't register
		logrus.WithError(confNotValidErr).Error("Validation of config failed")
		return confNotValidErr
	}

	for {
		err := controller.Register()
		if err != nil {
			if isRetryable(err) {
				time.Sleep(time.Second * 5)
				continue
			} else {
				return err
			}
		}

		return err
	}
}