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] Add a rmdir state #62178

Closed
nicholasmhughes opened this issue Jun 16, 2022 · 0 comments · Fixed by #62179
Closed

[FEATURE REQUEST] Add a rmdir state #62178

nicholasmhughes opened this issue Jun 16, 2022 · 0 comments · Fixed by #62179
Labels
Feature new functionality including changes to functionality and code refactors, etc.

Comments

@nicholasmhughes
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
There isn't really a good native solution for "remove all empty directories in this tree".

Describe the solution you'd like
A native rmdir state which can delete empty directories below a given root.

Describe alternatives you've considered
Usually this problem is solved with some Jinja gymnastics to find empty directories and pass to file.absent, but that can be dangerous if the find operation is too broad as file.absent essentially performs the equivalent of rm -rf

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.

@nicholasmhughes nicholasmhughes added the Feature new functionality including changes to functionality and code refactors, etc. label Jun 16, 2022
nicholasmhughes added a commit to nicholasmhughes/salt that referenced this issue Jun 16, 2022
Ch3LL pushed a commit that referenced this issue Aug 3, 2022
* add file.rmdir tests for original function

* update file.rmdir exec module for recursive operation and verbose output

* fixes #62178 add file.rmdir state

* add older_than capability to file.rmdir exec and state modules

* change test to use direct import of file module

* Revert "change test to use direct import of file module"

This reverts commit ff8c666.

* revert previous test modification and add import to win_file

* rename file.rmdir state to file.pruned
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant