-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathup.go
More file actions
40 lines (36 loc) · 790 Bytes
/
up.go
File metadata and controls
40 lines (36 loc) · 790 Bytes
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
package main
import (
"os"
"sync"
"github.com/gliderlabs/hostctl/providers"
"github.com/spf13/cobra"
)
func init() {
Hostctl.AddCommand(upCmd)
}
var upCmd = &cobra.Command{
Use: "up <name> [<name>...]",
Short: "Provision host, wait until ready",
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 1 && defaultName == "" {
cmd.Usage()
os.Exit(1)
}
loadStdinUserdata()
if len(args) == 0 {
args = []string{defaultName}
}
provider, err := providers.Get(providerName, true)
fatal(err)
finished := progressBar(".", 2)
parallelWait(args, func(_ int, arg string, wg *sync.WaitGroup) {
defer wg.Done()
name := namespace + arg
if provider.Get(name) != nil {
return
}
fatal(provider.Create(newHost(name)))
})
finished()
},
}