Skip to content

Commit

Permalink
no no-restart option
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas committed Feb 19, 2021
1 parent 0616c04 commit 1d16a5b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
6 changes: 0 additions & 6 deletions x-pack/elastic-agent/pkg/agent/application/enroll_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ type EnrollCmdOption struct {
Staging string
FleetServerConnStr string
FleetServerPolicyID string
NoRestart bool
}

func (e *EnrollCmdOption) kibanaConfig() (*kibana.Config, error) {
Expand Down Expand Up @@ -178,18 +177,13 @@ func (c *EnrollCmd) Execute(ctx context.Context) error {
// enroll should use localhost as fleet-server is now running
// it must also restart
c.options.URL = "http://localhost:8000"
c.options.NoRestart = false
}

err := c.enrollWithBackoff(ctx)
if err != nil {
return errors.New(err, "fail to enroll")
}

if c.options.NoRestart {
return nil
}

if c.daemonReload(ctx) != nil {
c.log.Info("Elastic Agent might not be running; unable to trigger restart")
}
Expand Down
4 changes: 0 additions & 4 deletions x-pack/elastic-agent/pkg/agent/cmd/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func newEnrollCommandWithArgs(flags *globalFlags, _ []string, streams *cli.IOStr

addEnrollFlags(cmd)
cmd.Flags().BoolP("force", "f", false, "Force overwrite the current and do not prompt for confirmation")
cmd.Flags().Bool("no-restart", false, "Skip restarting the currently running daemon")

// used by install command
cmd.Flags().BoolP("from-install", "", false, "Set by install command to signal this was executed from install")
Expand Down Expand Up @@ -141,11 +140,9 @@ func enroll(streams *cli.IOStreams, cmd *cobra.Command, flags *globalFlags, args
}
}

noRestart, _ := cmd.Flags().GetBool("no-restart")
force, _ := cmd.Flags().GetBool("force")
if fromInstall {
force = true
noRestart = true
}

// prompt only when it is not forced and is already enrolled
Expand Down Expand Up @@ -192,7 +189,6 @@ func enroll(streams *cli.IOStreams, cmd *cobra.Command, flags *globalFlags, args
Staging: staging,
FleetServerConnStr: fServer,
FleetServerPolicyID: fPolicy,
NoRestart: noRestart,
}

c, err := application.NewEnrollCmd(
Expand Down

0 comments on commit 1d16a5b

Please sign in to comment.