Exemplo n.º 1
0
func waitForServerState(scaleway *api.ScalewayAPI, serverID, targetState string) error {
	return resource.Retry(60*time.Minute, func() *resource.RetryError {
		scaleway.ClearCache()

		s, err := scaleway.GetServer(serverID)

		if err != nil {
			return resource.NonRetryableError(err)
		}

		if s.State != targetState {
			return resource.RetryableError(fmt.Errorf("Waiting for server to enter %q state", targetState))
		}

		return nil
	})
}