Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Heartbeat] Remove not needed flags from setup command #11856

Merged
merged 1 commit into from
May 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions heartbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,36 @@ package cmd

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

"github.com/elastic/beats/heartbeat/beater"
_ "github.com/elastic/beats/heartbeat/monitors/defaults"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a blank import should be only in a main or test package, or have a comment justifying it

cmd "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.GenRootCmdWithSettings(beater.New, instance.Settings{Name: Name})
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(cmd.TemplateKey, false, "Setup index template")
setup.Flags().Bool(cmd.ILMPolicyKey, false, "Setup ILM policy")
}