From 125025157bdfb99256c9f49fac07957c83a04848 Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Fri, 28 Jun 2019 10:21:51 -0700 Subject: [PATCH] Hides a perviously exported struct. Shortens a line that was too long. --- cmd/create.go | 15 +++++++++------ cmd/monitor.go | 2 +- cmd/start.go | 8 ++++---- cmd/stop.go | 4 ++-- cmd/util.go | 6 +++--- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/cmd/create.go b/cmd/create.go index 0359c1c..5be3035 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -164,13 +164,16 @@ func createJob(cmd *cobra.Command, args []string) { if err := client.CreateJob(auroraJob); err != nil { log.Fatal("unable to create Aurora job: ", err) - } else { - if ok, monitorErr := client.InstancesMonitor(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil { - if err := client.KillJob(auroraJob.JobKey()); err != nil { - log.Fatal(monitorErr, err) - } - log.Fatal(monitorErr) + } + + if ok, monitorErr := client.InstancesMonitor(auroraJob.JobKey(), + auroraJob.GetInstanceCount(), + 5, + 50); !ok || monitorErr != nil { + if err := client.KillJob(auroraJob.JobKey()); err != nil { + log.Fatal(monitorErr, err) } + log.Fatal(monitorErr) } } diff --git a/cmd/monitor.go b/cmd/monitor.go index c364c7f..55a1863 100644 --- a/cmd/monitor.go +++ b/cmd/monitor.go @@ -38,7 +38,7 @@ var monitorCmd = &cobra.Command{ Short: "Watch for a specific state change", } -var monitorHostCmd = MonitorCmdConfig{ +var monitorHostCmd = monitorCmdConfig{ cmd: &cobra.Command{ Use: "hosts", Short: "Watch a host maintenance status until it enters one of the desired statuses.", diff --git a/cmd/start.go b/cmd/start.go index ca9aea1..bad3814 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -68,7 +68,7 @@ var startCmd = &cobra.Command{ Short: "Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.", } -var startDrainCmd = MonitorCmdConfig{ +var startDrainCmd = monitorCmdConfig{ cmd: &cobra.Command{ Use: "drain [space separated host list]", Short: "Place a list of space separated Mesos Agents into draining mode.", @@ -89,7 +89,7 @@ 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.`, } -var startSLACountDrainCmd = MonitorCmdConfig{ +var startSLACountDrainCmd = monitorCmdConfig{ cmd: &cobra.Command{ Use: "count [space separated host list]", Short: "Place a list of space separated Mesos Agents into maintenance mode using the count SLA aware policy as a fallback.", @@ -99,7 +99,7 @@ when a Job does not have a defined SLA policy.`, }, } -var startSLAPercentageDrainCmd = MonitorCmdConfig{ +var startSLAPercentageDrainCmd = monitorCmdConfig{ cmd: &cobra.Command{ Use: "percentage [space separated host list]", Short: "Place a list of space separated Mesos Agents into maintenance mode using the percentage SLA aware policy as a fallback.", @@ -109,7 +109,7 @@ when a Job does not have a defined SLA policy.`, }, } -var startMaintenanceCmd = MonitorCmdConfig{ +var startMaintenanceCmd = monitorCmdConfig{ cmd: &cobra.Command{ Use: "maintenance [space separated host list]", Short: "Place a list of space separated Mesos Agents into maintenance mode.", diff --git a/cmd/stop.go b/cmd/stop.go index 9af9a66..0ff6cee 100644 --- a/cmd/stop.go +++ b/cmd/stop.go @@ -21,7 +21,7 @@ import ( "github.com/spf13/cobra" ) -var stopMaintenanceConfig = MonitorCmdConfig{} +var stopMaintenanceConfig = monitorCmdConfig{} func init() { rootCmd.AddCommand(stopCmd) @@ -46,7 +46,7 @@ var stopCmd = &cobra.Command{ Short: "Stop a service or maintenance on a host (DRAIN).", } -var stopMaintCmd = MonitorCmdConfig{ +var stopMaintCmd = monitorCmdConfig{ cmd: &cobra.Command{ Use: "drain [space separated host list]", Short: "Stop maintenance on a host (move to NONE).", diff --git a/cmd/util.go b/cmd/util.go index 70ea954..d728f03 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -25,10 +25,10 @@ import ( "github.com/spf13/cobra" ) -type MonitorCmdConfig struct { - cmd *cobra.Command +type monitorCmdConfig struct { + cmd *cobra.Command monitorInterval, monitorTimeout time.Duration - statusList []string + statusList []string } func toJSON(v interface{}) string {