Skip to content

Conversation

Bravo555
Copy link
Member

@Bravo555 Bravo555 commented Oct 1, 2024

Proposed changes

Stop setting file ownership in tedge-agent, which runs as tedge user. Also added a missing test for a case when a file is owned by root.

Setting file ownership is a privileged operation, which should be done by tedge-write. It's also unnecessary to change permissions on a temporary file which is atomically moved into destination by config-manager anyway.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

This change should resolve the issue and is small, so it'd be good to merge it ASAP. It resolves first 2 points of #3143 (comment), i.e. adds missing test case and removes the usage of chown while running as tedge.

We still unnecessarily leave temporary files, but that will be done in a follow-up PR.

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Oct 1, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
507 0 2 507 100 1h35m3.655162999s

@Bravo555 Bravo555 force-pushed the fix/3143/collectd-config-permission branch from b382473 to c3da4c7 Compare October 1, 2024 13:50
@Bravo555 Bravo555 temporarily deployed to Test Pull Request October 1, 2024 13:50 — with GitHub Actions Inactive
@Bravo555 Bravo555 force-pushed the fix/3143/collectd-config-permission branch from c3da4c7 to e92db8f Compare October 1, 2024 14:45
@Bravo555 Bravo555 temporarily deployed to Test Pull Request October 1, 2024 14:45 — with GitHub Actions Inactive
@Bravo555 Bravo555 changed the title Stop chowning in tedge-agent fix: Stop chowning in tedge-agent Oct 1, 2024
@Bravo555 Bravo555 force-pushed the fix/3143/collectd-config-permission branch from e92db8f to e01d391 Compare October 2, 2024 09:10
@Bravo555 Bravo555 temporarily deployed to Test Pull Request October 2, 2024 09:10 — with GitHub Actions Inactive
Stop setting file ownership in tedge-agent, which runs as `tedge` user.
Also added a missing test for a case when a file is owned by root.

Setting file ownership is a privileged operation, which should be done
by tedge-write. It's also unnecessary to change permissions on a
temporary file which is atomically moved into destination by
config-manager anyway.

Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
@Bravo555 Bravo555 force-pushed the fix/3143/collectd-config-permission branch from e01d391 to fcd1679 Compare October 2, 2024 09:46
@Bravo555 Bravo555 requested a review from reubenmiller as a code owner October 2, 2024 09:46
@Bravo555 Bravo555 temporarily deployed to Test Pull Request October 2, 2024 09:46 — with GitHub Actions Inactive
Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved

@Bravo555 Bravo555 added this pull request to the merge queue Oct 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 2, 2024
@Bravo555 Bravo555 added this pull request to the merge queue Oct 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 2, 2024
@Bravo555
Copy link
Member Author

Bravo555 commented Oct 2, 2024

Tried to merge 2 times, 3 tests failed, but they don't repeat across both tries, seems they're flakes? Going to test them with flake-finder:

  • Tests.Tedge Connect.Tedge Connect Offline.Check offline bootstrapping
  • Tests.Tedge Agent.Workflows.Custom Operation
    • Command steps should not be executed twice
    • Placeholder workflow created for ill-defined operations

@Bravo555 Bravo555 added this pull request to the merge queue Oct 2, 2024
Merged via the queue into thin-edge:main with commit a50bdcf Oct 2, 2024
33 checks passed
@reubenmiller reubenmiller added the theme:configuration Theme: Configuration management label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:configuration Theme: Configuration management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants