User story #3675
Technique "Set the permissions on files": should allow specifying regex to match files
Currently defining same ownership/permissions for a list of files/directories in filesPermissions technique (Set permissions on files) is quite tedious as same settings have to be repeated for each file/dir. It would be great if using a regular expression in place of path was allowed.
Since CFEngine already allows this, implementation should be quite simple. The only reason it doesn't work today is because the technique uses
fileexists function to check if the path exists. I was thinking about modifying it so that check is only done if the path does not contain any regular expression meta-characters. Or maybe removing the check altogether would be fine?
I can work on the implementation but wanted to discuss this first. What do you think about such change?
#1 Updated by Nicolas PERRON about 5 years ago
- Project changed from Rudder to Techniques
- Subject changed from filesPermissions technique should allow specifying regex to match files to Technique "Set the permissions on files": should allow specifying regex to match files
- Category deleted (
That could be a good idea. We take your proposition into account and will return you our feedback as soon as possible. Thank you !
#2 Updated by Nicolas PERRON about 5 years ago
Michael, we have figured out that your proposition fit exactly Rudder purpose.
In our point of view, the good way to do it should be "add another and optionnal textbox to specify the regexp of the files matched".
This regexp could be used in the CFEngine code to add a file_select body with a leaf_name (https://cfengine.com/archive/manuals/cf3-Reference#file_005fselect-in-files) matching it.
The fileexists() should be left as-is or workaround to be functionnal.