commands/commands.go
func machineCommand(actionName string, host *host.Host, errorChan chan<- error) {
	// TODO: These actions should have their own type.
	commands := map[string](func() error){
		"configureAuth":    host.ConfigureAuth,
		"configureAllAuth": host.ConfigureAllAuth,
		"start":            host.Start,
		"stop":             host.Stop,
		"restart":          host.Restart,
		"kill":             host.Kill,
		"upgrade":          host.Upgrade,
		"ip":               printIP(host),
		"provision":        host.Provision,
	}

	log.Debugf("command=%s machine=%s", actionName, host.Name)

	errorChan <- commands[actionName]()
}
func machineCommand(actionName string, host *host.Host, errorChan chan<- error) {
	// TODO: These actions should have their own type.
	commands := map[string](func() error){
		"configureAuth":    host.ConfigureAuth,
		"configureAllAuth": host.ConfigureAllAuth,
		"start":            host.Start,
		"stop":             host.Stop,
		"restart":          host.Restart,
		"kill":             host.Kill,
		"upgrade":          host.Upgrade,
		"ip":               printIP(host),
		"provision":        host.Provision,
	}

	log.Debugf("command=%s machine=%s", actionName, host.Name)

	errorChan <- commands[actionName]()
}
// machineCommand maps the command name to the corresponding machine command.
// We run commands concurrently and communicate back an error if there was one.