Пример #1
0
func cmdExec(pod *jetpack.Pod, rtapp types.ACName, args []string) error {
	app := pod.GetApp(rtapp)
	if app == nil {
		return errors.New("CAN'T HAPPEN")
	}
	app.Exec = args
	return errors.Trace(pod.RunApp(rtapp, app))
}
Пример #2
0
func cmdRun(pod *jetpack.Pod) (erv error) {
	if flAppName.Empty() {
		if len(pod.Manifest.Apps) != 1 {
			return errors.New("Multi-app pod! Please use -app=NAME to choose")
		} else {
			flAppName = pod.Manifest.Apps[0].Name
		}
	}
	if flDestroy {
		defer func() {
			if err := pod.Destroy(); err != nil {
				if erv == nil {
					erv = err
				} else {
					// TODO: UI
					fmt.Fprintln(os.Stderr, "ERROR destroying pod:", err)
				}
			}
		}()
	}
	return errors.Trace(pod.RunApp(flAppName, nil))
}