Forum: CFEngine Help
Subject: path_name in file_select creating empty directories
Author: crd
Link to topic: https://cfengine.com/forum/read.php?3,23726,23726#msg-23726

Hello,

I have a files promise which is supposed to copy from a tmp directory to the 
local apache conf directory. I want extra files to be purged and everything to 
be copied with some exceptions defined with a file_select.

My files promise is:

vars:
"excluded_dirs" slist   => {
                        
"$(g.local_generic_source)/devVMs_static/apache_conf_dir/mods-enabled.*",
                        
"$(g.local_generic_source)/devVMs_static/apache_conf_dir/mods-available.*",
                        
"$(g.local_generic_source)/devVMs_static/apache_conf_dir/sites-enabled.*",
                        
"$(g.local_generic_source)/devVMs_static/apache_conf_dir/sites-available.*",
                };
files:
"/etc/apache2/."
        comment                 =>      "verify apache config directory is up 
to date",
        create                  =>      "true",
        copy_from               =>      
no_backup_dcp_purge("$(g.local_generic_source)/devVMs_static/apache_conf_dir/"),
        depth_search                       =>   recurse("inf"),
        file_select             =>      ex_list_test(@(excluded_dirs)),
        classes                             =>          
if_repaired("restart_apache");



My file_select body is:

body file_select ex_list_test(names)
{
path_name  => { @(names)};
file_result => "!path_name";
}


This setup works in as much as files inside the excluded_dirs are not copied, 
but the directories themselves (e.g. /etc/apache2/mods-available) are still 
created empty.

 Is this expected behaviour? Or is there something amiss with my promise?

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

Reply via email to