We want to do a recursive copy of all files in masterfiles ending
with .template to a template directory and .template should be removed
from the filename during the process.
        
It would be nice if this could be done in one step but it does not looks
like it is possible.
        
We have not found a way to remove .template from $(this.promiser) so we
use the workaround you see below were only one level of directories is
searched for files and we use pcre matching to remove .template.
        
If someone knows how to do this for all files under this directory I
will be very happy.
        
files:
  "$(templates_dir)"
       comment => "Copy the templates from masterfiles to templates",
        handle => "update_files_templates_dir",
     copy_from => u_rcp("$(master_location)","$(sys.policy_hub)"),
  depth_search => u_recurse_ignore("inf",".git"),
   file_select => u_by_name( ".*\.template" ),
        action => u_immediate;
        
  "$(templates_dir)/.*/(.*)\.template"
       comment => "Rename the templates from file.template to file",
        handle => "update_files_templates_dir_rename",
        rename => u_to("$(match.1)"),
        action => u_immediate;
        
Best regards
Ove

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to