edit_line is a "subroutine", do either

--------------------------------------------------
vars:

 "lines" string =>

"
/scripts....
/batch..
";

files:

  "/etc/auto_direct"
                 comment         => "Installing  /batch and /scripts",
                 create          => "true",
                 edit_line      => append_if_no_lines("$(lines)");

OR ----------------------------------------

vars:

 "lines" slist => { "/scripts....","/batch.." };

files:

  "/etc/auto_direct"
                 comment         => "Installing  /batch and /scripts",
                 create          => "true",
                 edit_line      => append_if_no_lines("@(lines)");



Mark Nelson wrote:
> Hello
> 
> I'm trying to add two lines into a file using the edit_line statement
> 
> My code looks as follows -
> 
> 
>   TestServers::
>         "/etc/auto_direct"
>                 comment         => "Installing  /batch and /scripts",
>                 create          => "true",
>                 edit_line      => append_if_no_lines("/scripts            
>     -soft  server1:/export/dbm/scripts"),
>                 edit_line       => append_if_no_lines("/batch          
> -soft  server1:/export/dbm/batch"),
>                 perms           => mog("444","root","root");
> 
> What I expected was to have both entries in /etc/auto_direct.  I am
> however,only getting the line -
> 
> /batch           -soft  server1:/export/dbm/batch"
> 
> The only way I have managed to do this is as follows -
> 
> 
>       TestServers::
>         "/etc/auto_direct"
>                 comment         => "Installing  /batch and /scripts",
>                 create          => "true",
>                 edit_line       => append_if_no_lines("/batch          
> -soft  server1:/export/dbm/batch"),
>                 perms           => mog("444","root","root");
> 
>       TestServers::
>         "/etc/auto_direct"
>                 comment         => "Installing  /scripts",
>                 create          => "true",
>                 edit_line       => append_if_no_lines("/scripts
> -soft  server1:/export/dbm/scripts"),
>                 perms           => mog("444","root","root");
> 
> 
> Should I be able to add two lines to a file using the first piece of code
> or have I misunderstood how edit_line works.
> 
> 
> I am using the standard library that was released a few days ago and
> cfengine 3.0.2
> 
> Thanks
> 
> 
> Mark.
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine

-- 
Mark Burgess

-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway

Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to