From f014f09f4d3da948abdd94ef095effb6ca9976cd Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Fri, 15 Jan 2021 10:48:46 +0100 Subject: [PATCH] [Ingest Manager] Agent fetching DBus service PID fix (#23496) [Ingest Manager] Agent fetching DBus service PID fix (#23496) --- x-pack/elastic-agent/CHANGELOG.next.asciidoc | 2 ++ .../elastic-agent/pkg/agent/application/upgrade/service.go | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 75478112e8c..0150642e0ae 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -32,6 +32,8 @@ - Remove artifacts on transient download errors {pull}23235[23235] - Skip top level files when unziping archive during upgrade {pull}23456[23456] - Do not take ownership of Endpoint log path {pull}23444[23444] +- Fixed fetching DBus service PID {pull}23496[23496] +- Fix issue of missing log messages from filebeat monitor {pull}23514[23514] ==== New features diff --git a/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go b/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go index 2c21d020f8b..097fabb6855 100644 --- a/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go +++ b/x-pack/elastic-agent/pkg/agent/application/upgrade/service.go @@ -171,7 +171,12 @@ func (p *dbusPidProvider) Close() { } func (p *dbusPidProvider) PID(ctx context.Context) (int, error) { - prop, err := p.dbusConn.GetServiceProperty(install.ServiceName, "MainPID") + sn := install.ServiceName + if !strings.HasSuffix(sn, ".service") { + sn += ".service" + } + + prop, err := p.dbusConn.GetServiceProperty(sn, "MainPID") if err != nil { return 0, errors.New("failed to read service", err) }