salt icon indicating copy to clipboard operation
salt copied to clipboard

Proposing new functionality : to include or exclude pattern (regexp) when manipulating directories/files via file.recurse or file.directory

Open mlister2006 opened this issue 14 years ago • 3 comments

I have certain use cases where I need to include or exclude files, when manipulating directories/files via file.recurse or file.directory, instead of just syncing the whole directory.
Example: (1) Sending selective files/directories from salt master (source area) to minions (destination). (2) On minions, If certain applications is creating an additional data in a destination directory maintained via file.recurse, then preserve application data, instead of wiping it clean if files/directories are not present in the source.

I wrote a patch for states/file.py , hoping it can be included going forward. Please let me know if it is ok to initiate a pull request for above feature.

mlister2006 avatar Oct 26 '12 18:10 mlister2006

I think this would be a great feature, could we make it configurable to use regex or globs?

thatch45 avatar Oct 26 '12 18:10 thatch45

glob is an excellent idea. I made it default in my changes and regexp as an option with E@[PATTERN]. Just filed a pull request. please have a look.

mlister2006 avatar Oct 26 '12 22:10 mlister2006

I merged it, you did this in a great way, documented it well and the code looks good, I am really excited about this.

thatch45 avatar Oct 26 '12 22:10 thatch45