[augeas-devel] Re: Augeas and Puppet

David Lutterkort dlutter at redhat.com
Fri Aug 1 19:16:31 UTC 2008


On Fri, 2008-08-01 at 09:39 +0200, Raphaël Pinson wrote:


> Why specify the lens? I don't think you can force the lens with the
> augeas API, and it's not necessary since augeas knows what lens to use
> on what file.

Agreed; if it's needed, it's a fairly easy addition to the Augeas API +
the puppet type. But for now, there's no need for it.

> I'm personnaly for keeping the xpath syntax in puppet, because
> otherwise we lose a lot of functionality from augeas, so I was
> thinking of something like :
> 
> 
> augeas { 
> 
> "/files/etc/my.cnf/mysqld/query_cache_limit":
>    action => set,
>    value  => "1048576",
>    notify => Service["mysql"];
> 
> "/files/etc/my.cnf/mysqld/log-slow-queries":
>    action => rm,
>    notify => Service["mysql"];
> 
> "/files/etc/logrotate.d/apache2/rule[1]":
>    action => mv,
>    newnode => "/files/etc/logrotate.d/apache2/rule[2]",
>    notify => Service["logrotate"];
> 
> }

That's how I had initially thought about it, but unfortunately, you
sometimes need to make multiple changes to the Augeas tree at once
before it is in a valid state that can be saved and yields a valid
config file. Since puppet doesn't have subtransactions, you can only
save the Augeas tree either after processing each resource or at the end
of a transaction. The latter is clearly unworkable (since changes to
files wouldn't show up in the filesystem until the very end of the
puppet run)

That's why in Bryan's implementation, the type uses an array of actions
to specify an atomic change, e.g.

        augeas {
          context => "/files/etc/grub.conf",
          changes => [
            "set default 7",
            "set timeout 10"
          ]
        }

David





More information about the augeas-devel mailing list