diff --git a/cmd/docs.go b/cmd/docs.go index 0752d0d..f34497a 100644 --- a/cmd/docs.go +++ b/cmd/docs.go @@ -1,24 +1,23 @@ package cmd import ( - "github.com/spf13/cobra" - "github.com/spf13/cobra/doc" + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" ) func init() { - rootCmd.AddCommand(docsCmd) + rootCmd.AddCommand(docsCmd) } var docsCmd = &cobra.Command{ - Use: "docs", - Short: "Kill an Aurora Job", + Use: "docs", + Short: "Kill an Aurora Job", PersistentPreRun: func(cmd *cobra.Command, args []string) {}, // We don't need a realis client for this cmd PersistentPostRun: func(cmd *cobra.Command, args []string) {}, // We don't need a realis client for this cmd - Run: func(cmd *cobra.Command, args []string) { - err := doc.GenMarkdownTree(rootCmd, "./docs") - if err != nil { - log.Fatal(err) - } - }, + Run: func(cmd *cobra.Command, args []string) { + err := doc.GenMarkdownTree(rootCmd, "./docs") + if err != nil { + log.Fatal(err) + } + }, } - diff --git a/cmd/root.go b/cmd/root.go index 1dcda6b..99809ee 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -29,6 +29,7 @@ var count int64 var filename string var message = new(string) var updateID string +var statusList = make([]string, 0, 0) var log = logrus.New() const australisVer = "v0.0.8" diff --git a/cmd/start.go b/cmd/start.go index eb010c2..d87be05 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -58,7 +58,13 @@ are not allowed to schedule new tasks and any tasks already running on this Agen are killed and rescheduled in an Agent that is not in maintenance mode. Command expects a space separated list of hosts to place into maintenance mode.`, Args: cobra.MinimumNArgs(1), - Run: drain, + PreRun: func(cmd *cobra.Command, args []string) { + // Manually initializing default values for this command as the default value for shared variables will + // be dependent on the order in which all commands were initialized + monitorTimeout = time.Minute * 10 + monitorInterval = time.Second * 5 + }, + Run: drain, } var startSLADrainCmd = &cobra.Command{ @@ -76,7 +82,13 @@ var startSLACountDrainCmd = &cobra.Command{ Long: `Adds a Mesos Agent to Aurora's Drain list. Tasks will be drained using the count SLA policy as a fallback when a Job does not have a defined SLA policy.`, Args: cobra.MinimumNArgs(1), - Run: SLACountDrain, + PreRun: func(cmd *cobra.Command, args []string) { + // Manually initializing default values for this command as the default value for shared variables will + // be dependent on the order in which all commands were initialized + monitorTimeout = time.Minute * 20 + monitorInterval = time.Second * 10 + }, + Run: SLACountDrain, } var startSLAPercentageDrainCmd = &cobra.Command{ @@ -85,7 +97,13 @@ var startSLAPercentageDrainCmd = &cobra.Command{ Long: `Adds a Mesos Agent to Aurora's Drain list. Tasks will be drained using the percentage SLA policy as a fallback when a Job does not have a defined SLA policy.`, Args: cobra.MinimumNArgs(1), - Run: SLAPercentageDrain, + PreRun: func(cmd *cobra.Command, args []string) { + // Manually initializing default values for this command as the default value for shared variables will + // be dependent on the order in which all commands were initialized + monitorTimeout = time.Minute * 20 + monitorInterval = time.Second * 10 + }, + Run: SLAPercentageDrain, } var startMaintenanceCmd = &cobra.Command{ @@ -95,7 +113,13 @@ var startMaintenanceCmd = &cobra.Command{ are de-prioritized for scheduling a task. Command expects a space separated list of hosts to place into maintenance mode.`, Args: cobra.MinimumNArgs(1), - Run: maintenance, + PreRun: func(cmd *cobra.Command, args []string) { + // Manually initializing default values for this command as the default value for shared variables will + // be dependent on the order in which all commands were initialized + monitorTimeout = time.Minute * 1 + monitorInterval = time.Second * 5 + }, + Run: maintenance, } func drain(cmd *cobra.Command, args []string) {