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

[FEATURE REQUEST] Support for deleting unconfigured lines in file.keyvalue #65631

Open
tacerus opened this issue Nov 28, 2023 · 1 comment · May be fixed by #65640
Open

[FEATURE REQUEST] Support for deleting unconfigured lines in file.keyvalue #65631

tacerus opened this issue Nov 28, 2023 · 1 comment · May be fixed by #65640
Assignees
Labels
Feature new functionality including changes to functionality and code refactors, etc. needs-triage

Comments

@tacerus
Copy link

tacerus commented Nov 28, 2023

Is your feature request related to a problem? Please describe.

Currently the file.keyvalue state function only allows for either the modification of existing lines, or the addition of new lines.
It would be great if it could be used to prune lines not passed to be configured.

Describe the solution you'd like

Add an optional argument, such as clean, which, if set to true, enables the deletion of lines not passed via key_values: {}.

Describe alternatives you've considered

  • Use additional states with dependency logic to prune the file before executing file.keyvalue.

  • Use file.managed and construct the key value pairs manually .

Additional context

I will submit a proposed patch.

Please Note
If this feature request would be considered a substantial change or addition, this should go through a SEP process here https://github.com/saltstack/salt-enhancement-proposals, instead of a feature request.

@tacerus tacerus added Feature new functionality including changes to functionality and code refactors, etc. needs-triage labels Nov 28, 2023
@tacerus tacerus linked a pull request Nov 29, 2023 that will close this issue
3 tasks
@OrangeDog
Copy link
Contributor

OrangeDog commented Nov 30, 2023

This is what file.serialize does when using the keyvalue serializer without the merge_if_exists option.

@Akm0d Akm0d self-assigned this May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc. needs-triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants