Trevor Vaughan
2012-Jul-25 15:01 UTC
[Puppet Users] Purge-like ability for the augeas type?
I''ve been searching around but haven''t found a way to do something like a purge with augeas. If you have a file such as [iniheader] entry1 (managed by puppet) entry2 (not managed by puppet) And you want to add ''entry3'' as well as removing anything not managed by puppet in that subsection then you currently do not have this capability. Is this correct? I know how to get around this with concat, but I was hoping to not mix the two for a single file set. Thanks, Trevor -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaughan@onyxpoint.com -- This account not approved for unencrypted proprietary information -- -- 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. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dominic Cleal
2012-Jul-25 15:35 UTC
Re: [Puppet Users] Purge-like ability for the augeas type?
On 25/07/12 16:01, Trevor Vaughan wrote:> I''ve been searching around but haven''t found a way to do something > like a purge with augeas. > > If you have a file such as > > [iniheader] > entry1 (managed by puppet) > entry2 (not managed by puppet) > > And you want to add ''entry3'' as well as removing anything not managed > by puppet in that subsection then you currently do not have this > capability.In your Augeas resource, you could `rm` all other settings before setting your own within a single resource. If this produces no actual change in the written config file then the resource won''t "change" either. rm /files/etc/foo.ini/iniheader/* set /files/etc/foo.ini/iniheader/entry1 foo set /files/etc/foo.ini/iniheader/entry2 bar If you''re managing the same section across multiple Augeas resources (e.g. more of a use case for Puppet''s purge) then I don''t think there''s a good solution. Perhaps you could mark your Puppet-managed resources with a comment (a #comment subnode usually) and then delete anything that doesn''t match it. -- Dominic Cleal Red Hat Consulting m: +44 (0)7817 878113 -- 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. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Trevor Vaughan
2012-Jul-25 18:31 UTC
Re: [Puppet Users] Purge-like ability for the augeas type?
Hi Dominic, Yeah, multiple augeas resources is the problem. The comment is a reasonable idea but I think it''ll be more work than just falling back to concat. Thanks, Trevor On Wed, Jul 25, 2012 at 11:35 AM, Dominic Cleal <dcleal@redhat.com> wrote:> On 25/07/12 16:01, Trevor Vaughan wrote: >> I''ve been searching around but haven''t found a way to do something >> like a purge with augeas. >> >> If you have a file such as >> >> [iniheader] >> entry1 (managed by puppet) >> entry2 (not managed by puppet) >> >> And you want to add ''entry3'' as well as removing anything not managed >> by puppet in that subsection then you currently do not have this >> capability. > > In your Augeas resource, you could `rm` all other settings before > setting your own within a single resource. If this produces no actual > change in the written config file then the resource won''t "change" either. > > rm /files/etc/foo.ini/iniheader/* > set /files/etc/foo.ini/iniheader/entry1 foo > set /files/etc/foo.ini/iniheader/entry2 bar > > If you''re managing the same section across multiple Augeas resources > (e.g. more of a use case for Puppet''s purge) then I don''t think there''s > a good solution. Perhaps you could mark your Puppet-managed resources > with a comment (a #comment subnode usually) and then delete anything > that doesn''t match it. > > -- > Dominic Cleal > Red Hat Consulting > m: +44 (0)7817 878113 > > > -- > 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. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaughan@onyxpoint.com -- This account not approved for unencrypted proprietary information -- -- 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. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.