[FEATURE REQUEST] file.keyvalue should be able to manage file permissions and ownership #67296
Replies: 1 comment
-
|
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
file.keyvaluecurrently provides the create_if_missing flag, but controlling the created (or existing) file's ownership or permissions is impossible.As mentioned in the original bug, #63545,
file.serializeis another option to controlkeyvaluefiles and it does allow for owner/perm controls, but it is more suited to managing an entire file and not specific values in the file.serializer.keyvaluedoesn't support the same options thatfile.keyvaluedoes (e.g.uncomment,append...,prepend..., etc.), and it is also unable to handle any data that doesn't match the<key><separator><value>formatting such as line comments.So, you can't have a situation where your expected output is:
file.keyvaluewill correctly handle the file contents, uncommenting lines if necessary, pre/appending, ignoring line comments, etc., but the ownership will be 🤷♀️file.serializewill create and manage the file with the correct ownership, but the file contents will not be handled correctly. Specifically, pre-existing line comments will cause the deserializer to barf and fail to modify the file at all:With an existing file of:
Results in errors like:
Having to add a separate
file.managedstate to accomplish this is clunky at best, because thefile.managedandfile.keyvaluecan't exist in the same state without errors:Attempting this
Will result in errors:
Beta Was this translation helpful? Give feedback.
All reactions