[Puppet-dev] Re: [augeas-devel] Re: Augeas and Puppet
Raphaël Pinson
raphink at gmail.com
Fri Aug 1 12:37:08 UTC 2008
On Fri, Aug 1, 2008 at 12:21 PM, David Schmitt <david at schmitt.edv-bus.at>wrote:
>
> Hi Raphaël, folks!
>
> Raphaël Pinson schrieb:
>
> > 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"];
> >
> > }
> >
> >
> > I believe using an "action" parameter is better than using "set",
> "insert",
> > "rm", etc. because using the latter would make you think that you can
> > perform several actions in one puppet call, which is not possible (or I
> > don't know how to do it at least :) ).
>
> The xpath syntax looks great and I can't wait to get my hands on
> puppet+augeas (on Debian ;-) )
>
> On the point of the action parameter, I'd recommend following the
> established puppet patterns and calling the "verb"-parameter "ensure"
> and the possible values declarative:
>
> | augeas {
> |
> | "/files/etc/my.cnf/mysqld/query_cache_limit":
> | ensure => present,
> | value => "1048576",
> | notify => Service["mysql"];
> |
> | "/files/etc/my.cnf/mysqld/log-slow-queries":
> | ensure => absent,
> | notify => Service["mysql"];
> |
> | "/files/etc/logrotate.d/apache2/rule[2]":
> | ensure => copy,
> | newnode => "/files/etc/logrotate.d/apache2/rule[1]",
> | notify => Service["logrotate"];
> | replace => false,
> | }
>
Very good idea indeed, but that means ensure=absent has to be converted into
a rm. As for ensure=copy/replace=false, I'm not really sure. Right now,
there is no "cp" command in Augeas (but it should come soon), only "mv" is
implemented.
Especially with "action => mv" this is a big problem. How should puppet
> act on subsequent runs? After the first run, rule[1] wouldn't exist
> anymore and rule[2] would be deleted then?
>
Yes indeed. This is linked to the discussion on
https://www.redhat.com/archives/augeas-devel/2008-August/msg00002.html .
>
> > Calling the object "augeas" makes it clear that it's an an editfile
> syntax
> > like in Cfengine, but specifically an augeas syntax, and that this object
> is
> > likely to evolve with the augeas API.
> >
> >
> > When it comes to setting several values with one call, I think it is the
> > task of specific constructed types in puppet, like :
> >
> > define mysql::server ( $query_cache_limit="123456", $log-slow-queries,
> other
> > parameters...) {
> >
> > blah blah
> > package management
> > blah blah
> >
> >
> > augeas {
> > "/files/etc/mysql.cnf/query_cache_limit":
> > action => set,
> > value => "123456";
> >
> > "/files/etc/my.cnf/log-slow-queries":
> > action => rm;
> > }
> >
> > }
> >
> >
> > This type could check for values, and do :
> > - set the value if the value is defined
> > - rm the value if the value is not defined
> >
>
> This is very puppet-like: Have a well-built, tightly scoped low-level
> tool and "export" it by providing a separate, equally tightly scoped
> high-level define for a specific use case. It's similar to git's
> plumbing/porcelain split, although git has only one scope to look at,
> while puppet has many (conffile handling, managing
> {mysql,apache,mediawiki,postgres,exim,postfix,...}).
>
Yes, I think the puppet interface to augeas has to be both really close to
the augeas API, and fit for puppet usage.
Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080801/8dad570b/attachment.htm>
More information about the augeas-devel
mailing list