Right - it seems the delete_lines is deleting on the second pass the lines 
inserted by the first pass, which is strange.

This should not be happening - I'll investigate and try to figure out what's 
going on.

--Diego


On Jul 24, 2012, at 1:24 PM, no-re...@cfengine.com wrote:

> Forum: CFEngine Help
> Subject: Re: delete_lines and select region
> Author: jbdenis
> Link to topic: https://cfengine.com/forum/read.php?3,26551,26636#msg-26636
> 
> Ok. Got it in the train on my way back home. I have to "protect" the 
> delete_lines to append if the insert_lines part has already been run. 
> Something like the following (not well tested, this is just the spirit) : 
> 
> bundle edit_line editfile
> {
>  vars:
>      "sdelim"       string => "#### CFENGINE ANCHOR";
>      # We do this to make the classname unique per filename, so that this 
> bundle
>      # can be used on different files without interference.
>        "deletedone"    string => 
> concat(canonify("$(edit.filename)"),"_delete_region_done");
>        "insertdone"     string => 
> concat(canonify("$(edit.filename)"),"_insert_region_done");
> 
> 
> 
>  delete_lines:
>      ".*"
>        select_region => from_line("$(sdelim)"),
>        classes => if_ok("$(deletedone)"),
>        ifvarclass => "!$(deletedone).!$(insertdone)";
> 
>      # I want to insert my anchor line if it is not present the first time
>  insert_lines:
>      "1";
>      "2";
>      "3";
>      classes =>  if_ok("$(insertdone)");
> }
> 
> _______________________________________________
> 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