Forum: Cfengine Help
Subject: Re: Cfengine Help: Re: Strange behaviour with insert_lines
Author: babudro
Link to topic: https://cfengine.com/forum/read.php?3,18791,18794#msg-18794

Daniel V. Klein Wrote:
-------------------------------------------------------
> Look at "empty_file_before_editing".  You need to

Yes, that's what I am using.  From the COPBL I am using this:


body edit_defaults empty
{
empty_file_before_editing => "true";
edit_backup => "false";
max_file_size => "300000";
}


Now that I understand my original question about why the repeated lines were 
not inserted, my confusion has moved on to the preserve_block feature you and 
Mark both mentioned:  Why does perserve_block re-write the file every time if I 
empty it?  Why would I want to use it (i.e., what does it do for me)?  Maybe if 
one of you could give a short example of using preserve_block that would help.  
I tried these two techniques:


insert_lines:
"line 1
line 2
line 3",
insert_type => "preserve_text";


and also


insert_lines:
"line 1" insert_type => "preserve_text";
"line 2" insert_type => "preserve_text";
"line 3" insert_type => "preserve_text";


... but either way, if I emptied the file first it always re-wrote it.  (And 
the second method really didn't work at all; duplicated lines were ignored as 
if "preserve_block" wasn't there, so I presume the first method is the correct 
one.)

Thanks for the help.

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

Reply via email to