-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fall back to os.Get[ug]id if user.Current() fails #28696
Conversation
This pull request does not have a backport label. Could you fix it @david-kow? 🙏
NOTE: |
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
This pull request does not have a backport label. Could you fix it @david-kow? 🙏
NOTE: |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
(cherry picked from commit 7af0c20)
(cherry picked from commit 7af0c20)
(cherry picked from commit 7af0c20) Co-authored-by: David Kowalski <[email protected]>
(cherry picked from commit 7af0c20) Co-authored-by: David Kowalski <[email protected]>
What does this PR do?
In the case of
user.Current()
call failing withuser.UnknownUserIdError
we fallback toos.Getuid()
andos.Getgid()
to populateuid
andgid
values respectively.Why is it important?
#28265 added populating
username
,uid
andgid
for diagnostic purposes. This information is taken from password database (eg./etc/passwd
file) based onuid
. Unfortunately, in some cases an entry for currentuid
is not present there. This is the case in Kubernetes when user setsuid
of their choice. This is currently breaking ECK E2E tests for7.16.0-SNAPSHOT
.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added tests that prove my fix is effective or that my feature worksI have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Run the agent normally then use:
elastic-agent diagnostics
Related issues
All credit goes to @barkbay 🙇