From 1a7229f494de4a75081eff96a5b979cbce0216b5 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Wed, 13 Jan 2021 16:41:23 +0100 Subject: [PATCH 1/2] try with service --- .../elastic-agent/pkg/agent/application/upgrade/service.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) } From 7aee72645df82eac54acad98210dec7d081beccf Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Thu, 14 Jan 2021 09:40:02 +0100 Subject: [PATCH 2/2] changelog' --- x-pack/elastic-agent/CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 1efbca81fac..994613b653d 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -32,6 +32,7 @@ - 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] ==== New features