Skip to content

Commit

Permalink
[Heartbeat] Remove not needed flags from setup command
Browse files Browse the repository at this point in the history
Backport of elastic#11856 to 6.8

The setup command until now contained all the possible options from the other Beats. As Heartbeat does not ship anymore with dashboards, the --dashboards command is not needed anymore and is only confusing. I also removed all the other commands except --ilm-policy and --template. I'm not aware that --pipelines or --machine-learning would be used.

Here the comparison between ./heartbeat setup -h from before and after.
  • Loading branch information
andrewvc committed May 29, 2019
1 parent 4c34994 commit 76c06c8
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions heartbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,36 @@ package cmd

import (
// register default heartbeat monitors
_ "github.com/elastic/beats/heartbeat/monitors/defaults"

"github.com/elastic/beats/heartbeat/beater"
cmd "github.com/elastic/beats/libbeat/cmd"
_ "github.com/elastic/beats/heartbeat/monitors/defaults"
"github.com/elastic/beats/libbeat/cmd"
"github.com/elastic/beats/libbeat/cmd/instance"
)

// Name of this beat
var Name = "heartbeat"

// RootCmd to handle beats cli
var RootCmd = cmd.GenRootCmd(Name, "", beater.New)
var RootCmd *cmd.BeatsRootCmd

func init() {
RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name})

// remove dashboard from export commands
for _, cmd := range RootCmd.ExportCmd.Commands() {
if cmd.Name() == "dashboard" {
RootCmd.ExportCmd.RemoveCommand(cmd)
}
}

// only add defined flags to setup command
setup := RootCmd.SetupCmd
setup.Short = "Setup Elasticsearch index template and pipelines"
setup.Long = `This command does initial setup of the environment:
* Index mapping template in Elasticsearch to ensure fields are mapped.
* ILM Policy
`
setup.ResetFlags()
setup.Flags().Bool("template", false, "Setup index template")
setup.Flags().Bool("ilm-policy", false, "Setup ILM policy")
}

0 comments on commit 76c06c8

Please sign in to comment.