Exemplo n.º 1
0
Arquivo: sky.go Projeto: yahame/skynet
func ListHosts(q *skynet.Query) {
	results := q.FindHosts()

	for _, host := range results {
		fmt.Println(host)
	}
}
Exemplo n.º 2
0
// TODO: this should be smarter about which hosts it deploys to
func Deploy(q *skynet.Query, path string, args ...string) {
	cl := client.NewClient(&config)

	fmt.Println("deploying " + path + " " + strings.Join(args, ""))

	for _, host := range q.FindHosts() {
		cdaemon := daemon.GetDaemonForHost(cl, host)

		in := daemon.DeployRequest{
			ServicePath: path,
			Args:        shellquote.Join(args...),
		}
		out, err := cdaemon.Deploy(in)

		if err != nil {
			fmt.Println(err)
			return
		}

		deployTemplate.Execute(os.Stdout, out)
	}
}