Dennis,
the problem is in your code. You have quotes around your body reference in the
example you
sent me now
bundle edit_line AppendIfNoLine(proxy_lines) {
insert_lines:
"$(proxy_lines)" location => "append";
}
Take away the quotes from "append" and it works.
What is puzzling is why you don't get an error message warning you about this.
I'll look
into that.
M
On 02/04/2011 10:27 AM, [email protected] wrote:
> The problem still exists in 3.1.4-1. The line will append at the end of
> the file instead of using the locator. :-(
>
>
>> I've had this exact problem and do not know how to fix it. It has caused
>> me
>> to stop using file editing all together and even templates. Since any
>> file
>> that has sections cannot be counted on to be sane after cf-agent runs.
>>
>> On Tue, Jan 11, 2011 at 5:45 AM, <[email protected]> wrote:
>>
>>> The following syntax should work, according to documentation and
>>> examples:
>>>
>>> ----------
>>> body common control {
>>> bundlesequence => { "test" };
>>> }
>>>
>>> bundle agent test {
>>> files:
>>> "/tmp/yum.conf"
>>> edit_line => append_after_main;
>>> }
>>>
>>> bundle edit_line append_after_main {
>>> insert_lines:
>>> "Please insert me" location => yum_conf;
>>> }
>>>
>>> body location yum_conf {
>>> before_after => "after";
>>> first_last => "first";
>>> select_line_matching => "\[main\]";
>>> }
>>> ----------
>>>
>>> This doesn't work unfortunatly. It appends the line at the end of the
>>> file
>>> each time it finds the regexp. So I end up with multiple lines at the
>>> end
>>> of the file, instead of one line after the locator.
>>>
>>> My working cfengine 2 syntax is this:
>>>
>>> ----------
>>> editfiles:
>>> {
>>> /etc/yum.conf
>>> BeginGroupIfNoSuchLine "Please insert me"
>>> LocateLineMatching "\[main\]"
>>> InsertLine "Please insert me"
>>> EndGroup
>>> }
>>> ----------
>>>
>>> Hope someone can help me out. Thanks in advance.
>>>
>>> Kind regards,
>>>
>>> Dennis
>>> _______________________________________________
>>> Help-cfengine mailing list
>>> [email protected]
>>> https://cfengine.org/mailman/listinfo/help-cfengine
>>>
>> _______________________________________________
>> Help-cfengine mailing list
>> [email protected]
>> https://cfengine.org/mailman/listinfo/help-cfengine
>>
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine