I agree - for the specific example, set_variable_values seems like a good way of doing it. You could also use a template with edit_template, and just insert the values that you want, then the file will preserve the formatting from the template.
--Diego On Sep 3, 2012, at 3:37 PM, Nick Anderson <n...@cmdln.org> wrote: > On 09/03/2012 05:10 AM, Gregory Matthews wrote: >>> On 31/08/12 17:30, Diego Zamboni wrote: >>>> Greg, >>>> >>>> You could split the lines into a list, then you can still pass them to >>>> insert_lines but they will not be indented. Just separate them by >>>> commas in your code, should work fine. > undle agent test { >> vars: >> "eth00" slist => { "#comment", >> "NETMASK=255.255.255.0", >> "BROADCAST=172.23.7.255", >> "IPADDR_START=172.23.4.1", >> "IPADDR_END=172.23.4.1", >> "CLONENUM_START=0" }; > >> In other words, you /have/ to define the list as a variable in advance. >> I tried playing around defining my own edit_line bundle but not had much >> success so far! > > Hi Greg this isn't exactly what you asked about but I thought it applied to > the general discussion. > > You might want to check out the edit_lines set_variable_values bundle. > > I attached an example of using set_variable_values, that also uses list > iteration for more concise activation. It seems appropriate for use with your > example. > > Also I think its also important to recognize the different between passing a > list and a string to an edit_line bundle. > Here is the output from executing the attached list_iteration.cf > > You can see from this output that /tmp/list1.txt gets edited multiple times, > and list2.txt gets edited just once. > > cf-agent -KIf ./list_iteration.cf > > -> Created file /tmp/list1.txt, mode = 384 > -> Edited file /tmp/list1.txt > -> Edited file /tmp/list1.txt > -> Edited file /tmp/list1.txt > -> Created file /tmp/list2.txt, mode = 384 > -> Edited file /tmp/list2.txt > > <list_iteration.cf><set_variable_values.cf>_______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine