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, <dennis.caboo...@snow.nl> 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
> 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

Reply via email to