From ab2b4784d057d6ab4d5fa19493dc8e527484fc41 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 16 Mar 2021 16:51:55 +0100 Subject: [PATCH] Fix default scope in add_nomad_metadata (#24559) Fix default scope in add_nomad_metadata. It is set to local, but it should be node. Fix also error message that showed that local is a valid value. --- CHANGELOG.next.asciidoc | 1 + x-pack/libbeat/autodiscover/providers/nomad/config.go | 2 +- x-pack/libbeat/processors/add_nomad_metadata/config.go | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 0cba32ae396..44ddadada89 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -399,6 +399,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Fix Netflow module issue with missing `internal_networks` config parameter. {issue}24094[24094] {pull}24110[24110] - in httpjson input using encode_as "application/x-www-form-urlencoded" now sets Content-Type correctly {issue}24331[24331] {pull}24336[24336] - Fix netflow module ignoring detect_sequence_reset flag. {issue}24268[24268] {pull}24270[24270] +- Fix default `scope` in `add_nomad_metadata`. {issue}24559[24559] *Heartbeat* diff --git a/x-pack/libbeat/autodiscover/providers/nomad/config.go b/x-pack/libbeat/autodiscover/providers/nomad/config.go index 7108bf87943..1a611aceee3 100644 --- a/x-pack/libbeat/autodiscover/providers/nomad/config.go +++ b/x-pack/libbeat/autodiscover/providers/nomad/config.go @@ -64,7 +64,7 @@ func (c *Config) Validate() error { case ScopeNode: case ScopeCluster: default: - return fmt.Errorf("invalid value for `scope`, select `%s` or `%s`", ScopeNode, ScopeCluster) + return fmt.Errorf("invalid value for `scope`: %s, select `%s` or `%s`", c.Scope, ScopeNode, ScopeCluster) } return nil } diff --git a/x-pack/libbeat/processors/add_nomad_metadata/config.go b/x-pack/libbeat/processors/add_nomad_metadata/config.go index 6425f05550c..daeeccc6513 100644 --- a/x-pack/libbeat/processors/add_nomad_metadata/config.go +++ b/x-pack/libbeat/processors/add_nomad_metadata/config.go @@ -40,7 +40,7 @@ func (c *nomadAnnotatorConfig) Validate() error { case ScopeNode: case ScopeCluster: default: - return fmt.Errorf("invalid value for `scope`, select `local` or `global`") + return fmt.Errorf("invalid value for `scope`: %s, select `%s` or `%s`", c.Scope, ScopeNode, ScopeCluster) } return nil } @@ -57,7 +57,7 @@ func defaultNomadAnnotatorConfig() nomadAnnotatorConfig { Region: "", Namespace: "", SecretID: "", - Scope: "local", + Scope: ScopeNode, syncPeriod: 5 * time.Second, CleanupTimeout: 60 * time.Second, DefaultMatchers: Enabled{true},