-
Notifications
You must be signed in to change notification settings - Fork 66
fix: make tedge-write not reset owner/group #2974
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
fix: make tedge-write not reset owner/group #2974
Conversation
Robot Results
|
493a953
to
82ad08d
Compare
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.
Adding an option to use plain uid/gid numbers is a good idea. And the fix seems correct. But, you have to come with another way to test it without assuming chown privileges.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
43f5705
to
d4bc9ce
Compare
d4bc9ce
to
e05e910
Compare
61da3df
to
5e0cb80
Compare
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.
Indeed replacing system tests by integration tests is more appropriate. The code being correct, I will approve this PR once rebased with the system-tests fix.
fixes: thin-edge#2972 Fixed two closely related problems in tedge-write: - When destination file existed, its owner/group was reset because when creating a temporary file for atomic write we forgot to set the same permissions as the destination file. Now we copy destination file permissions to the temporary, ensuring that after the rename permissions stay the same. - Changed some permissions used in the tests from 644 to 666, so the tests don't fail when default umask is different. Also added new functionality: tedge-write can now use plain uid/gid numbers to change owner instead of needing a name. This was done so we can more easily test file owner changes, but is probably a user improvement in its own right. Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
To properly test tedge-write, we need to be running in the environment where 1. sudo is installed 2. we run as `tedge` user 3. there is a sudoers entry that allows tedge to `sudo tedge-write` without password RobotFramework provides that environment, so tests of tedge-write functionality were moved there. Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
5e0cb80
to
6dfdbc5
Compare
69bdfe1 is expected to fix the failing |
69bdfe1
to
4176c35
Compare
After verifying with @reubenmiller, we decided that the test was indeed checking the wrong thing, so the fix was to change the test itself. I decided not to bother with the umask in Cumulocity Configuration Operation suite, as it should be already handled in the Tedge Write suite. Should be good to merge now. |
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.
Approved
Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
Test `Set Configuration when file exists` is changed to be consistent with its comment that suggests that permissions for existing files should not change. The test now actually asserts that permissions of `/etc/config1.json` and `/etc/binary-config1.tar.gz` stay unchanged. Previously, the test seemed to actually assert if the permission did change, despite the comment claiming otherwise. Changing of permission was not desirable, and along with resetting the owner of the file, was part of a bug that is now fixed, so either the test must've been wrong to begin with, or tedge-write behaviour is specified incorrectly. `/etc/config1.json` was created with permissions 664, but the test verified that they were 644 after the operation, which isn't consistent with what's in `tedge-configuration-plugin.toml`, but is the default file permissions with default umask 002, so a new file being created without any changes to default permissions fulfilled the requirements of the test. Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
b94ea1f
to
70f761f
Compare
Proposed changes
Fixed two closely related problems in tedge-write:
Also added new functionality: tedge-write can now use plain uid/gid numbers to change owner instead of needing a name. This was done so we can more easily test file owner changes, but is probably a user improvement in its own right.
Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments