From 5357c186ccf11ec80626f461dfd5fbd763e897f3 Mon Sep 17 00:00:00 2001 From: Anderson Queiroz Date: Mon, 8 Jan 2024 16:02:42 +0100 Subject: [PATCH] wip --- go.mod | 2 +- go.sum | 4 ++-- libbeat/version/helper.go | 8 -------- x-pack/libbeat/management/managerV2.go | 5 +++-- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index fdcba8718dde..607fce1ee4b0 100644 --- a/go.mod +++ b/go.mod @@ -419,4 +419,4 @@ replace ( // Exclude this version because the version has an invalid checksum. exclude github.com/docker/distribution v2.8.0+incompatible -replace github.com/elastic/elastic-agent-client/v7 => github.com/AndersonQ/elastic-agent-client/v7 v7.0.0-20240108094727-ab590759de8d +replace github.com/elastic/elastic-agent-client/v7 => github.com/AndersonQ/elastic-agent-client/v7 v7.0.0-20240108150033-8c2dfcb2d868 diff --git a/go.sum b/go.sum index 738f10704240..0ba1e3e570d4 100644 --- a/go.sum +++ b/go.sum @@ -83,8 +83,8 @@ github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= -github.com/AndersonQ/elastic-agent-client/v7 v7.0.0-20240108094727-ab590759de8d h1:4RpV8WPkT+GUlWAOzUevjL1FwD3d9JaxDoKfDxQ1IBw= -github.com/AndersonQ/elastic-agent-client/v7 v7.0.0-20240108094727-ab590759de8d/go.mod h1:arA5Vauukv2jFKcobkXoC/d28/jFFLnxVW1bQEIHDGA= +github.com/AndersonQ/elastic-agent-client/v7 v7.0.0-20240108150033-8c2dfcb2d868 h1:3EM8SWAHL1j6LsX3TLybG9RBfzoAYdmbWMNexWFs/4I= +github.com/AndersonQ/elastic-agent-client/v7 v7.0.0-20240108150033-8c2dfcb2d868/go.mod h1:arA5Vauukv2jFKcobkXoC/d28/jFFLnxVW1bQEIHDGA= github.com/Azure/azure-amqp-common-go/v3 v3.2.1 h1:uQyDk81yn5hTP1pW4Za+zHzy97/f4vDz9o1d/exI4j4= github.com/Azure/azure-amqp-common-go/v3 v3.2.1/go.mod h1:O6X1iYHP7s2x7NjUKsXVhkwWrQhxrd+d8/3rRadj4CI= github.com/Azure/azure-event-hubs-go/v3 v3.3.15 h1:2yAik9gS5Qjs4Z6EM1B6d0tfZJ506B/0oA08JlRQxb8= diff --git a/libbeat/version/helper.go b/libbeat/version/helper.go index fcaf0a05c843..bfe621570a10 100644 --- a/libbeat/version/helper.go +++ b/libbeat/version/helper.go @@ -19,20 +19,12 @@ package version import "time" -// packageVersion is the Elastic Agent's package version. When running in managed -// mode the beats should report the Agent's package version instead its own version. -var packageVersion string - // GetDefaultVersion returns the current libbeat version. // This method is in a separate file as the version.go file is auto generated // TODO(AndersonQ): does it need to be changed? in the agent's code there is still a GetDefaultVersion // with the same behaviour as this one and it's used in several place. And there // is another function for the package version. func GetDefaultVersion() string { - if packageVersion != "" { - return packageVersion - } - if qualifier == "" { return defaultBeatVersion } diff --git a/x-pack/libbeat/management/managerV2.go b/x-pack/libbeat/management/managerV2.go index 0e8deeb0fe0c..d4bac953a79d 100644 --- a/x-pack/libbeat/management/managerV2.go +++ b/x-pack/libbeat/management/managerV2.go @@ -165,9 +165,10 @@ func NewV2AgentManager(config *conf.C, registry *reload.Registry) (lbmanagement. if err != nil { return nil, fmt.Errorf("faile dreading connection information from stdin: %w", err) } + ver := version.GetDefaultVersion() - if connInfo.VersionOverride != "" { - ver = connInfo.VersionOverride + if connInfo.PackageVersion != "" { + ver = connInfo.PackageVersion } var agentClient client.V2