-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
82 lines (74 loc) · 2.43 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package main
import (
"fmt"
"os"
"github.com/elodina/stack-deploy/command"
"github.com/elodina/stack-deploy/framework"
"github.com/elodina/stack-deploy/mesosrunners"
"github.com/elodina/stack-deploy/runners"
"github.com/mitchellh/cli"
"time"
)
func main() {
cli := cli.NewCLI("stack-deploy", "0.3.5.2")
cli.Args = os.Args[1:]
cli.Commands = commands()
exitCode, err := cli.Run()
if err != nil {
fmt.Printf("Error exiting CLI: %s\n", err)
os.Exit(1)
}
os.Exit(exitCode)
}
func commands() map[string]cli.CommandFactory {
return map[string]cli.CommandFactory{
"server": func() (cli.Command, error) {
return command.NewServerCommand(taskRunners, mesosTaskRunners), nil
},
"ping": func() (cli.Command, error) {
return new(command.PingCommand), nil
},
"list": func() (cli.Command, error) {
return new(command.ListCommand), nil
},
"show": func() (cli.Command, error) {
return new(command.ShowCommand), nil
},
"run": func() (cli.Command, error) {
return new(command.RunCommand), nil
},
"add": func() (cli.Command, error) {
return new(command.AddStackCommand), nil
},
"remove": func() (cli.Command, error) {
return new(command.RemoveStackCommand), nil
},
"adduser": func() (cli.Command, error) {
return new(command.AddUserCommand), nil
},
"refreshtoken": func() (cli.Command, error) {
return new(command.RefreshTokenCommand), nil
},
"addlayer": func() (cli.Command, error) {
return new(command.AddLayerCommand), nil
},
"scheduled": func() (cli.Command, error) {
return new(command.ScheduledCommand), nil
},
}
}
// Register your custom task runners here
var taskRunners map[string]framework.TaskRunner = map[string]framework.TaskRunner{
"kafka-mesos-0.9.x": new(runners.KafkaTaskRunner),
"exhibitor-mesos-0.1.x": new(runners.ExhibitorTaskRunner),
"dse-mesos-0.1.x": new(runners.DSETaskRunner),
"dse-mesos-0.2.x": new(runners.DSE02xTaskRunner),
"statsd-mesos-0.1.x": new(runners.StatsdTaskRunner),
"syslog-mesos-0.1.x": new(runners.SyslogTaskRunner),
"zipkin-mesos-0.1.x": new(runners.ZipkinTaskRunner),
"go-kafka-client-mesos-0.3.x": new(runners.GoKafkaClientTaskRunner),
"elasticsearch": runners.NewElasticsearchTaskRunner(5*time.Minute, 2*time.Second),
}
var mesosTaskRunners map[string]framework.MesosTaskRunner = map[string]framework.MesosTaskRunner{
"run-once": mesosrunners.NewRunOnceRunner(),
}