Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #23496 to 7.x: Agent fetching DBus service PID fix #23525

Merged
merged 3 commits into from
Jan 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Support for linux/arm64 {pull}23479[23479]
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down