Skip to content

Commit

Permalink
Chane fleetmode detection to ony use management.enabled (#26180)
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)
  • Loading branch information
michel-laterman authored and mergify-bot committed Jun 8, 2021
1 parent 8a79a3c commit 1580d1a
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 1580d1a

Please sign in to comment.