Hides a perviously exported struct. Shortens a line that was too long.

This commit is contained in:
Renan DelValle 2019-06-28 10:21:51 -07:00
parent cbac86cb20
commit 125025157b
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
5 changed files with 19 additions and 16 deletions

View file

@ -164,13 +164,16 @@ func createJob(cmd *cobra.Command, args []string) {
if err := client.CreateJob(auroraJob); err != nil { if err := client.CreateJob(auroraJob); err != nil {
log.Fatal("unable to create Aurora job: ", err) 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 { if ok, monitorErr := client.InstancesMonitor(auroraJob.JobKey(),
log.Fatal(monitorErr, err) auroraJob.GetInstanceCount(),
} 5,
log.Fatal(monitorErr) 50); !ok || monitorErr != nil {
if err := client.KillJob(auroraJob.JobKey()); err != nil {
log.Fatal(monitorErr, err)
} }
log.Fatal(monitorErr)
} }
} }

View file

@ -38,7 +38,7 @@ var monitorCmd = &cobra.Command{
Short: "Watch for a specific state change", Short: "Watch for a specific state change",
} }
var monitorHostCmd = MonitorCmdConfig{ var monitorHostCmd = monitorCmdConfig{
cmd: &cobra.Command{ cmd: &cobra.Command{
Use: "hosts", Use: "hosts",
Short: "Watch a host maintenance status until it enters one of the desired statuses.", Short: "Watch a host maintenance status until it enters one of the desired statuses.",

View file

@ -68,7 +68,7 @@ var startCmd = &cobra.Command{
Short: "Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.", Short: "Start a service, maintenance on a host (DRAIN), a snapshot, or a backup.",
} }
var startDrainCmd = MonitorCmdConfig{ var startDrainCmd = monitorCmdConfig{
cmd: &cobra.Command{ cmd: &cobra.Command{
Use: "drain [space separated host list]", Use: "drain [space separated host list]",
Short: "Place a list of space separated Mesos Agents into draining mode.", 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.`, expects a space separated list of hosts to place into maintenance mode.`,
} }
var startSLACountDrainCmd = MonitorCmdConfig{ var startSLACountDrainCmd = monitorCmdConfig{
cmd: &cobra.Command{ cmd: &cobra.Command{
Use: "count [space separated host list]", 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.", 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{ cmd: &cobra.Command{
Use: "percentage [space separated host list]", 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.", 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{ cmd: &cobra.Command{
Use: "maintenance [space separated host list]", Use: "maintenance [space separated host list]",
Short: "Place a list of space separated Mesos Agents into maintenance mode.", Short: "Place a list of space separated Mesos Agents into maintenance mode.",

View file

@ -21,7 +21,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var stopMaintenanceConfig = MonitorCmdConfig{} var stopMaintenanceConfig = monitorCmdConfig{}
func init() { func init() {
rootCmd.AddCommand(stopCmd) rootCmd.AddCommand(stopCmd)
@ -46,7 +46,7 @@ var stopCmd = &cobra.Command{
Short: "Stop a service or maintenance on a host (DRAIN).", Short: "Stop a service or maintenance on a host (DRAIN).",
} }
var stopMaintCmd = MonitorCmdConfig{ var stopMaintCmd = monitorCmdConfig{
cmd: &cobra.Command{ cmd: &cobra.Command{
Use: "drain [space separated host list]", Use: "drain [space separated host list]",
Short: "Stop maintenance on a host (move to NONE).", Short: "Stop maintenance on a host (move to NONE).",

View file

@ -25,10 +25,10 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
type MonitorCmdConfig struct { type monitorCmdConfig struct {
cmd *cobra.Command cmd *cobra.Command
monitorInterval, monitorTimeout time.Duration monitorInterval, monitorTimeout time.Duration
statusList []string statusList []string
} }
func toJSON(v interface{}) string { func toJSON(v interface{}) string {