Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
Adding interval and timeout flags for start and stop drain.
Browse files Browse the repository at this point in the history
  • Loading branch information
ridv committed May 31, 2018
1 parent afa7a5d commit 51daad8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ var insecureSkipVerify bool
var caCertsPath string
var clientKey, clientCert string

var monitorInterval, monitorTimeout int

func init() {
rootCmd.PersistentFlags().StringVarP(&zkAddr, "zookeeper", "z", "", "Zookeeper node(s) where Aurora stores information.")
rootCmd.PersistentFlags().StringVarP(&username, "username", "u", "", "Username to use for API authentication")
Expand Down
11 changes: 8 additions & 3 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import (
func init() {
rootCmd.AddCommand(startCmd)


// Sub-commands
startCmd.AddCommand(startMaintCmd)

startMaintCmd.Flags().IntVar(&monitorInterval,"interval", 5, "Interval at which to poll scheduler.")
startMaintCmd.Flags().IntVar(&monitorTimeout,"timeout", 50, "Time after which the monitor will stop polling and throw an error.")

}

var startCmd = &cobra.Command{
Expand Down Expand Up @@ -44,8 +49,8 @@ func drain(cmd *cobra.Command, args []string) {
hostResult, err := monitor.HostMaintenance(
args,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED},
5,
10)
monitorInterval,
monitorTimeout)
if err != nil {
for host, ok := range hostResult {
if !ok {
Expand All @@ -57,5 +62,5 @@ func drain(cmd *cobra.Command, args []string) {
return
}

fmt.Print(result.String())
fmt.Println(result.String())
}

0 comments on commit 51daad8

Please sign in to comment.