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

Gary Larizza
Thu, 22 Mar 2012 23:48:23 -0000

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
(mailto: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


> >
> > John
> >
> > --
> > You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
> > To post to this group, send email to puppet-users@googlegroups.com
(mailto:puppet-users@googlegroups.com).
> > To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
(mailto:puppet-users%2Bunsubscribe@googlegroups.com).
> > For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
> >
>
> John
>
> I was hoping to use the File resource to deal with the whole file but the
man in charge says no...My goal was for /etc/sudoers to contain the basics plus
the includedir directive then all else would be managed from /etc/sudoers.d but
that won''t be happening.
>
> I have seen some sed options but this one does seem to work on anything not
starting with a ''#'' so we are going with it...Plus a single
define for both adding and removing lines is not a bad thing.
>
> John
> --
> You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com
(mailto:puppet-users@googlegroups.com).
> To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
(mailto:puppet-users+unsubscribe@googlegroups.com).
> For more options, visit this group at