Skip to content

Commit

Permalink
Chane fleetmode detection to ony use management.enabled (#26180) (#26211
Browse files Browse the repository at this point in the history
)

Fleetmode detection has been changed ton only use the enabled flag as
fleet is now the only management mode available.

(cherry picked from commit 689a746)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
  • Loading branch information
mergify[bot] and michel-laterman authored Jun 9, 2021
1 parent ac0ef8c commit 3fb4d1a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions libbeat/common/fleetmode/fleet_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ import (

// Enabled checks to see if filebeat/metricbeat is running under Agent
// The management setting is stored in the main Beat runtime object, but we can't see that from a module
// So instead we check the CLI flags, since Agent starts filebeat/metricbeat with "-E", "management.mode=x-pack-fleet", "-E", "management.enabled=true"
// So instead we check the CLI flags, since Agent starts filebeat/metricbeat with "-E", "management.enabled=true"
func Enabled() bool {
type management struct {
Mode string `config:"management.mode"`
Enabled bool `config:"management.enabled"`
Enabled bool `config:"management.enabled"`
}
var managementSettings management

Expand All @@ -46,8 +45,5 @@ func Enabled() bool {
return false
}

if managementSettings.Enabled == true && managementSettings.Mode == "x-pack-fleet" {
return true
}
return false
return managementSettings.Enabled
}

0 comments on commit 3fb4d1a

Please sign in to comment.