Forum: CFEngine Help
Subject: Re: Concatenating multiple files
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,27049,27063#msg-27063

Is it out of the question to read each file into an array, and use an 
insert_lines promise with preserve_block to ensure that each file be added?  
Using an edit_defaults => empty as well should even preserve order.

I'm thinking something very roughly like this untested, probably syntactically 
invalid chunk o' code:


bundle agent awesomefile {
vars:
  "files" slist => { "however you figure out what files you need" };
  "file_contents[$(files)]" string => readfile( "$(files)", "inf" );
files:
  "awesomefile"
    edit_defaults => empty,
    edit_file => insert_lines( @(files) );
}
bundle edit_file insert_list( list ){
insert_lines:
  "${awesomefile[$(list)]" preserve_block => "true";
}


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

Reply via email to