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

feat(editors): enable editors to set file access permissions #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NucciTheBoss
Copy link
Member

This PR expands the capabilities of the dump and edit functions to set file mode, user, and group owner on Slurm configuration files. All the editors use the shared set_file_permissions function under the hood to perform the permissions modification. This functionality is needed to that we can ensure that configuration files are owned by the correct SlurmUser rather than them all being owned by root.

Misc.

Swaps out the tempfile we were creating on disk for the unit tests and replaces it with pyfakefs. This way we don't have to worry about manually cleaning up testing resources with the addition of each new unit test.

Adds the function `set_file_permissions` which is used by the dump function
of the editors to apply file mode, user, and group permissions to supported
configuration files. This makes Slurm happy because then we don't need to default
to root for everything, and can instead use the dedicated SlurmUser.

Signed-off-by: Jason C. Nucciarone <[email protected]>
Also improves coverage of the `editor` module.

Signed-off-by: Jason C. Nucciarone <[email protected]>
Use `pyfakefs` to create a mock Slurm configuration file where we would
expect it to be located on a node. Also helps for testing file permissions
as we don't need to mess with privileges on the host filesystem.

Signed-off-by: Jason C. Nucciarone <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Proposes a new feature to be added to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant