func doContainersGetFromNode(project, node string, cert *shared.CertInfo) ([]api.Container, error) {
	f := func() ([]api.Container, error) {
		client, err := cluster.Connect(node, cert, true)
		if err != nil {
			return nil, errors.Wrapf(err, "Failed to connect to node %s", node)
		}

		client = client.UseProject(project)

		containers, err := client.GetContainers()
		if err != nil {
			return nil, errors.Wrapf(err, "Failed to get containers from node %s", node)
		}

		return containers, nil
	}

	timeout := time.After(30 * time.Second)
	done := make(chan struct{})

	var containers []api.Container
	var err error

	go func() {
		containers, err = f()
		done <- struct{}{}
	}()

	select {
	case <-timeout:
		err = fmt.Errorf("Timeout getting containers from node %s", node)
	case <-done:
	}

	return containers, err
}
func doContainersGetFromNode(project, node string, cert *shared.CertInfo) ([]api.Container, error) {
	f := func() ([]api.Container, error) {
		client, err := cluster.Connect(node, cert, true)
		if err != nil {
			return nil, errors.Wrapf(err, "Failed to connect to node %s", node)
		}

		client = client.UseProject(project)

		containers, err := client.GetContainers()
		if err != nil {
			return nil, errors.Wrapf(err, "Failed to get containers from node %s", node)
		}

		return containers, nil
	}

	timeout := time.After(30 * time.Second)
	done := make(chan struct{})

	var containers []api.Container
	var err error

	go func() {
		containers, err = f()
		done <- struct{}{}
	}()

	select {
	case <-timeout:
		err = fmt.Errorf("Timeout getting containers from node %s", node)
	case <-done:
	}

	return containers, err
}
func doContainersGetFromNode ( project , node string , cert * shared . CertInfo ) ( [ ] api . Container , error ) { f := func ( ) ( [ ] api . Container , error ) { client , err := cluster . Connect ( node , cert , true ) if err != nil { return nil , errors . Wrapf ( err , " " , node ) } client = client . UseProject ( project ) containers , err := client . GetContainers ( ) if err != nil { return nil , errors . Wrapf ( err , " " , node ) } return containers , nil } timeout := time . After ( 30 * time . Second ) done := make ( chan struct { } ) var containers [ ] api . Container var err error go func ( ) { containers , err = f ( ) done <- struct { } { } } ( ) select { case <- timeout : err = fmt . Errorf ( " " , node ) case <- done : } return containers , err }
// Fetch information about the containers on the given remote node, using the
// rest API and with a timeout of 30 seconds.
Fetch information about the containers on the given remote node using the rest API and with a timeout of 30 seconds .