commands/commands.go
func runActionForeachMachine(actionName string, machines []*host.Host) []error {
	var (
		numConcurrentActions = 0
		errorChan            = make(chan error)
		errs                 = []error{}
	)

	for _, machine := range machines {
		numConcurrentActions++
		go machineCommand(actionName, machine, errorChan)
	}

	// TODO: We should probably only do 5-10 of these
	// at a time, since otherwise cloud providers might
	// rate limit us.
	for i := 0; i < numConcurrentActions; i++ {
		if err := <-errorChan; err != nil {
			errs = append(errs, err)
		}
	}

	close(errorChan)

	return errs
}
func runActionForeachMachine(actionName string, machines []*host.Host) []error {
	var (
		numConcurrentActions = 0
		errorChan            = make(chan error)
		errs                 = []error{}
	)

	for _, machine := range machines {
		numConcurrentActions++
		go machineCommand(actionName, machine, errorChan)
	}

	// TODO: We should probably only do 5-10 of these
	// at a time, since otherwise cloud providers might
	// rate limit us.
	for i := 0; i < numConcurrentActions; i++ {
		if err := <-errorChan; err != nil {
			errs = append(errs, err)
		}
	}

	close(errorChan)

	return errs
}
func runActionForeachMachine ( actionName string , machines [ ] * host . Host ) [ ] error { var ( numConcurrentActions = 0 errorChan = make ( chan error ) errs = [ ] error { } ) for _ , machine := range machines { numConcurrentActions ++ go machineCommand ( actionName , machine , errorChan ) } // TODO: We should probably only do 5-10 of these // at a time, since otherwise cloud providers might // rate limit us. for i := 0 ; i < numConcurrentActions ; i ++ { if err := <- errorChan ; err != nil { errs = append ( errs , err ) } } close ( errorChan ) return errs }
// runActionForeachMachine will run the command across multiple machines
runActionForeachMachine will run the command across multiple machines