-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.go
40 lines (30 loc) · 809 Bytes
/
status.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
// Copyright © 2018 Chef Software
package main
import (
"fmt"
"os"
"github.com/chef/automate/components/automate-deployment/pkg/a1upgrade"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(automateCtlStatusCmd())
}
func automateCtlStatusCmd() *cobra.Command {
return &cobra.Command{
Use: "status",
Short: "test double of `automate-ctl status`",
Long: `automate-ctl status will exit 0 by default.
To test failure cases set the FAILURE environment to 102:
FAILURE=102 automate-ctl status
`,
Run: automateCtlStatus,
}
}
func automateCtlStatus(cmd *cobra.Command, args []string) {
if a1upgrade.Failure(a1upgrade.PreflightA1Down) {
fmt.Println("automate-ctl status FAILURE (simulated)")
os.Exit(1)
}
fmt.Println("automate-ctl status SUCCESS (simulated)")
os.Exit(0)
}