[Puppet-dev] Re: [augeas-devel] Re: Augeas and Puppet

Raphaël Pinson raphink at gmail.com
Wed Aug 13 06:35:21 UTC 2008


On Wed, Aug 13, 2008 at 6:23 AM, David Lutterkort <dlutter at redhat.com>wrote:

> On Tue, 2008-08-12 at 10:11 +0200, Raphaël Pinson wrote:
>
>
> > I see an issue with this approach somehow. Puppet is "state-centered",
> > while Augeas is "change-centered". If you write a module that will
> > apply changes using Augeas, it will apply these changes at every run
> > of Puppet... Now Puppet resources usually have a state checker so that
> > the changes are only applied if a condition is met.
>
> At some point somebody has to turn a state description into actions -
> the question is whether that should happen in Puppet or in Augeas.
>
> > I think it would be suitable for the augeas module to work this way,
> > too :
> >
> >
> > augeas { "some-random-name":
> >     context => "/files/etc/yum.repos.d",
> >     changes => [
> >       "set fedora.repo/fedora/enabled 1",
> >       "set fedora.repo/fedora/gpgcheck 1",
> >       "set fedora-updates.repo/fedora-updates/enabled 1",
> >       "set fedora-updates.repo/fedora-updates/gpgcheck 1"
> >       ],
> >     onlyif => "get fedora.repo/fedora/enable != '1'"
> >
> > }
> >
> >
> > onlyif could take conditions based on "get" or "match" requests. Also,
> > the Puppet module could check all the values for the "set" actions and
> > only apply those that don't match.
>
> That's what I was thinking initially, too, but then figured that it will
> be much simpler if Augeas checks whether a change has actually been
> made; I intend to add a flag to aug_init so that Augeas will only ever
> touch a file if it truly changed.


That's a great idea.

The onlyif guard is a good idea - I can see how that would provide a lot

> more expressiveness.
>

The idea behind that is not only to make sure changes are applied only if
necessary, but also to try and get close to cfengine's editfile commands if
possible. Right now, I don't see how we could do something like an
'AppendIfNoSuchLine' or 'BeginGroupIfDefined' for example. The nature of
puppet and auges being slightly different from cfengine (and for good), we
will probably not end up with the same way of managing file edition at all,
but it would be good if there was a way to achieve the same results.


Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080813/b13d7f33/attachment.htm>


More information about the augeas-devel mailing list