Re: [Puppet Users] Re: Removing lines from a file

John Kennedy
Fri, 23 Mar 2012 09:43:30 -0000

On Thu, Mar 22, 2012 at 23:48, Gary Larizza <gary@puppetlabs.com> wrote:

>
> On Thursday, March 22, 2012 at 6:23 AM, John Kennedy wrote:
>
>
> On Thu, Mar 22, 2012 at 13:02, jcbollinger
<John.Bollinger@stjude.org>wrote:
>
>
> > - NOTE: I am adding and removing the #includedir line for testing...
> >
> > What needs to be changed to get this to work?
>
>
> Have you considered using sed instead of perl?  It''s
lighter-weight
> and very good at this sort of thing.
>
> Personally, however, I would be looking at using a File resource to
> manage the *whole file* instead of filtering out a few lines.
>
>
> Have you looked at the ''file_line'' type in
Puppet''s stdlib?
>
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/file_line.rb
>
>
>
>
Gary,
I can see where ''file_line'' will add a line but I
don''t know enough ruby to
know, will it remove a line that does exist?
Thanks,