-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscale.go
46 lines (38 loc) · 835 Bytes
/
scale.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
package main
import (
"log"
"github.com/FurqanSoftware/bullet/core"
"github.com/FurqanSoftware/bullet/spec"
"github.com/spf13/cobra"
)
var ScaleCmd = &cobra.Command{
Use: "scale",
Short: "Scale a specific service on the server",
Long: `This command scales a specific service of the app on the server.`,
Run: func(cmd *cobra.Command, args []string) {
spec, err := spec.ParseFile("Bulletspec")
if err != nil {
log.Fatal(err)
return
}
nodes, err := core.ParseNodeSet(Hosts, Port, Identity)
if err != nil {
log.Fatal(err)
return
}
nodes = core.SelectNodes(nodes)
comp, err := core.NewComposition(args)
if err != nil {
log.Fatal(err)
return
}
err = core.Scale(nodes, spec, comp)
if err != nil {
log.Fatal(err)
return
}
},
}
func init() {
RootCmd.AddCommand(ScaleCmd)
}