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

Given a set of similar files, and a list of different variables to be 
associated with each, how does one then construct a generalised set of 'file:' 
edits, so that the variables for fileA are associated with fileA (etc).  
Something like:

=========
bundle my_bundle {
vars:
  "fileA" string => "/path/to/fileA";
  "fileB" string => "/path/to/fileB";
  "all_files" slist => { "$(fileA)", "$(fileB)" };

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

  files:
    "$(all_files)"
      ...
      edit_line => my_edit("???");
}

bundle edit_line my_edit(varlist_for_fileX)
{
}
=========

So when "fileA" is being edited, the argument into "my_edit" should be 
"@(my_bundle.vars_for_fileA)", etc.

I get the feeling this should be well within scope for cfengine, but I cannot 
see how to achieve it.

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

Reply via email to