Thanks both for the help. Some things to think about there. I've used 
set_variable_values before for other config files but I feel that in 
this case, it results in an overly wordy .cf file. I've also used 
templates in certain circumstances. I will consider this further.

thanks again

GREG

On 03/09/12 23:22, Diego Zamboni wrote:
> 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
>


-- 
Greg Matthews        01235 778658
Scientific Computing Group Leader
Diamond Light Source Ltd. OXON UK

-- 
This e-mail and any attachments may contain confidential, copyright and or 
privileged material, and are for the use of the intended addressee only. If you 
are not the intended addressee or an authorised recipient of the addressee 
please notify us of receipt by returning the e-mail and do not use, copy, 
retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not 
necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments 
are free from viruses and we cannot accept liability for any damage which you 
may sustain as a result of software viruses which may be transmitted in or with 
the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and 
Wales with its registered office at Diamond House, Harwell Science and 
Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 



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

Reply via email to