Skip to content

Commit d441d3f

Browse files
committed
[Ingest Manager] Fix: Successfully installed and enrolled agent running standalone (#24128)
[Ingest Manager] Fix: Successfully installed and enrolled agent running standalone (#24128)
1 parent 9cad9ef commit d441d3f

3 files changed

Lines changed: 1 addition & 10 deletions

File tree

x-pack/elastic-agent/CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- Fixed Monitoring filebeat and metricbeat not connecting to Agent over GRPC {pull}23843[23843]
3636
- Windows agent doesn't uninstall with a lowercase `c:` drive in the path {pull}23998[23998]
3737
- Fix reloading of log level for services {pull}[24055]24055
38+
- Fix: Successfully installed and enrolled agent running standalone{pull}[24128]24128
3839

3940
==== New features
4041

x-pack/elastic-agent/pkg/agent/application/enroll_cmd.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ type EnrollCmdOption struct {
8484
Staging string
8585
FleetServerConnStr string
8686
FleetServerPolicyID string
87-
NoRestart bool
8887
}
8988

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

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

189-
if c.options.NoRestart {
190-
return nil
191-
}
192-
193187
if c.daemonReload(ctx) != nil {
194188
c.log.Info("Elastic Agent might not be running; unable to trigger restart")
195189
}

x-pack/elastic-agent/pkg/agent/cmd/enroll.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func newEnrollCommandWithArgs(flags *globalFlags, _ []string, streams *cli.IOStr
3838

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

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

144-
noRestart, _ := cmd.Flags().GetBool("no-restart")
145143
force, _ := cmd.Flags().GetBool("force")
146144
if fromInstall {
147145
force = true
148-
noRestart = true
149146
}
150147

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

198194
c, err := application.NewEnrollCmd(

0 commit comments

Comments
 (0)