Skip to content

Commit

Permalink
Prompt only when agent is already enrolled (elastic#21473)
Browse files Browse the repository at this point in the history
Prompt only when agent is already enrolled (elastic#21473)
  • Loading branch information
michalpristas committed Oct 5, 2020
1 parent 92b3460 commit b9569ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x-pack/elastic-agent/pkg/agent/cmd/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ func enroll(streams *cli.IOStreams, cmd *cobra.Command, flags *globalFlags, args
if fromInstall {
force = true
}
if !force {

// prompt only when it is not forced and is already enrolled
if !force && (cfg.Fleet != nil && cfg.Fleet.Enabled == true) {
confirm, err := c.Confirm("This will replace your current settings. Do you want to continue?", true)
if err != nil {
return errors.New(err, "problem reading prompt response")
Expand Down

0 comments on commit b9569ff

Please sign in to comment.