Skip to content

Create custom user package to obtain host user data#152

Merged
uri-weisman merged 11 commits intoelastic:mainfrom
uri-weisman:cloudbreat_crash_change_permissions
May 22, 2022
Merged

Create custom user package to obtain host user data#152
uri-weisman merged 11 commits intoelastic:mainfrom
uri-weisman:cloudbreat_crash_change_permissions

Conversation

@uri-weisman
Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions bot commented May 16, 2022

Cloudbeat CI 🤖

Integration tests passed! 💚
Tests Summary:

=========================== short test summary info ============================
PASSED integration/tests/test_output_to_elasticsearch.py::test_elastic_index_exists[file]
PASSED integration/tests/test_output_to_elasticsearch.py::test_elastic_index_exists[process]
PASSED integration/tests/test_output_to_elasticsearch.py::test_elastic_index_exists[k8s_object]
PASSED product/tests/test_cloudbeat.py::test_cloudbeat_pod_exist
PASSED product/tests/test_cloudbeat.py::test_cloudbeat_pods_running
================= 5 passed, 63 deselected, 6 warnings in 1.17s =================

Link to detailed report: https://elastic.github.io/cloudbeat/567

@uri-weisman uri-weisman requested a review from eyalkraft May 16, 2022 15:04
@uri-weisman uri-weisman marked this pull request as ready for review May 16, 2022 15:04
@uri-weisman uri-weisman requested a review from a team as a code owner May 16, 2022 15:04
@uri-weisman
Copy link
Copy Markdown
Collaborator Author

fixes #118

@uri-weisman uri-weisman changed the title Create custom user package to obtain os user data for host Create custom user package to obtain host user data May 16, 2022
@uri-weisman uri-weisman requested a review from eyalkraft May 17, 2022 10:03
Copy link
Copy Markdown
Contributor

@eyalkraft eyalkraft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tests! small changes required

func GetUserNameFromID(uid uint32, userFilePath string) string {
u := strconv.FormatUint(uint64(uid), 10)
usr, err := lookupUserId(u, userFilePath)
if err != nil || usr == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errors are completely silenced here. Let's return an error from both these functions and then on the consuming package log these errors and decide what to do (use empty string?)

@@ -0,0 +1,2 @@
wheel:*:0:root
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, let's move both mocks into resources/utils/mock/

FileMode: mod,
Uid: usr.Name,
Gid: group.Name,
Uid: utils.GetUserNameFromID(uid, UserFile),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good for now, let's open an issue for it as we discussed (as there are not uid/gid) and link it in a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uri-weisman uri-weisman linked an issue May 19, 2022 that may be closed by this pull request
@uri-weisman uri-weisman requested a review from eyalkraft May 22, 2022 09:43
Copy link
Copy Markdown
Contributor

@eyalkraft eyalkraft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test and ship

@uri-weisman uri-weisman merged commit 93a9e2a into elastic:main May 22, 2022
@uri-weisman uri-weisman deleted the cloudbreat_crash_change_permissions branch May 22, 2022 12:28
orouz pushed a commit to orouz/cloudbeat that referenced this pull request Sep 6, 2023
…c#152)

Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
orestisfl pushed a commit to orestisfl/cloudbeat that referenced this pull request Oct 11, 2023
…es_generator (elastic#152)

Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] cloudbeat crash once etcd folder changed group and user

2 participants