Forum: Cfengine Help
Subject: Passing slists as body parameters?
Author: jgreer
Link to topic: https://cfengine.com/forum/read.php?3,17713,17713#msg-17713

Is is possible to pass an slist as a parameter of a promise body without 
explicitly declaring an slist variable and passing it by name?  I'd like to do 
something like this:


bundle agent test {

#vars:
#
#   "exclude_dirs" slist =>  { "exclude1", "exclude2" };

files:

 "/tmp/testexclusion"
    copy_from    => copy_std("/var/cfengine/masterfiles/tmp/copy_from", 
"localhost", "false", "timestamp"),
    depth_search => recurse_ignore("inf", "@("exclude1", "exclude2")"),
#    depth_search => recurse_ignore("inf", "@(exclude_dirs)"),
    action       => actionsettings_fix_inform("inform");  


}

body depth_search recurse_ignore(d,list)
{
depth => "$(d)";
exclude_dirs => { @(list) };
}


The commented lines are an alternative, of course, but I'd rather just pass my 
exclusion regexes inline and avoid variable sprawl except in cases where 
reusing a set of patterns makes sense.  

Thanks,
-Jess

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

Reply via email to