Forum: CFEngine Help
Subject: Re: associating lists of variables with files
Author: Seva Gluschenko
Link to topic: https://cfengine.com/forum/read.php?3,22729,22730#msg-22730

David,

you can achieve your goals using arrays:


bundle my_bundle {
vars:
 "file" string => "/path/to/fileA";
 "file" string => "/path/to/fileB";

 "vars" slist => { "A1", "A2", "A3" };
 "vars" slist => { "B1", "B2" };

 "myfiles" slist => getindices("file");

files:
"$(file[$(myfiles)])"
 ...
 edit_line => my_edit("$(vars[$(myfiles)])");
}


You can find other examples in the reference:

http://cfengine.com/manuals/cf3-reference.html#Arrays-in-cfengine-3

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

Reply via email to