<div dir="ltr"><br><br><div class="gmail_quote">On Fri, Aug 1, 2008 at 12:21 PM, David Schmitt <span dir="ltr"><<a href="mailto:david@schmitt.edv-bus.at">david@schmitt.edv-bus.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Raphaël, folks!<br>
<br>
Raphaël Pinson schrieb:<br>
<div class="Ih2E3d"><br>
> I'm personnaly for keeping the xpath syntax in puppet, because otherwise we<br>
> lose a lot of functionality from augeas, so I was thinking of something like<br>
> :<br>
><br>
><br>
> augeas {<br>
><br>
> "/files/etc/my.cnf/mysqld/query_cache_limit":<br>
>    action => set,<br>
>    value  => "1048576",<br>
>    notify => Service["mysql"];<br>
><br>
> "/files/etc/my.cnf/mysqld/log-slow-queries":<br>
>    action => rm,<br>
>    notify => Service["mysql"];<br>
><br>
> "/files/etc/logrotate.d/apache2/rule[1]":<br>
>    action => mv,<br>
>    newnode => "/files/etc/logrotate.d/apache2/rule[2]",<br>
>    notify => Service["logrotate"];<br>
><br>
> }<br>
><br>
><br>
> I believe using an "action" parameter is better than using "set", "insert",<br>
> "rm", etc. because using the latter would make you think that you can<br>
> perform several actions in one puppet call, which is not possible (or I<br>
> don't know how to do it at least :) ).<br>
<br>
</div>The xpath syntax looks great and I can't wait to get my hands on<br>
puppet+augeas (on Debian ;-) )<br>
<br>
On the point of the action parameter, I'd recommend following the<br>
established puppet patterns and calling the "verb"-parameter "ensure"<br>
and the possible values declarative:<br>
<div class="Ih2E3d"><br>
| augeas {<br>
|<br>
| "/files/etc/my.cnf/mysqld/query_cache_limit":<br>
</div>|    ensure => present,<br>
<div class="Ih2E3d">|    value  => "1048576",<br>
|    notify => Service["mysql"];<br>
|<br>
| "/files/etc/my.cnf/mysqld/log-slow-queries":<br>
</div>|    ensure => absent,<br>
|    notify => Service["mysql"];<br>
|<br>
| "/files/etc/logrotate.d/apache2/rule[2]":<br>
|    ensure => copy,<br>
|    newnode => "/files/etc/logrotate.d/apache2/rule[1]",<br>
|    notify => Service["logrotate"];<br>
|    replace => false,<br>
| }<br>
</blockquote><div><br><br>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.<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Especially with "action => mv" this is a big problem. How should puppet<br>
act on subsequent runs? After the first run, rule[1] wouldn't exist<br>
anymore and rule[2] would be deleted then?<br><div class="Ih2E3d"></div></blockquote><div><br>Yes indeed. This is linked to the discussion on <a href="https://www.redhat.com/archives/augeas-devel/2008-August/msg00002.html">https://www.redhat.com/archives/augeas-devel/2008-August/msg00002.html</a> .<br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
<br>
> Calling the object "augeas" makes it clear that it's an an editfile syntax<br>
> like in Cfengine, but specifically an augeas syntax, and that this object is<br>
> likely to evolve with the augeas API.<br>
><br>
><br>
> When it comes to setting several values with one call, I think it is the<br>
> task of specific constructed types in puppet, like :<br>
><br>
> define mysql::server ( $query_cache_limit="123456", $log-slow-queries, other<br>
> parameters...) {<br>
><br>
> blah blah<br>
> package management<br>
> blah blah<br>
><br>
><br>
>     augeas {<br>
>         "/files/etc/mysql.cnf/query_cache_limit":<br>
>            action => set,<br>
>            value  => "123456";<br>
><br>
>         "/files/etc/my.cnf/log-slow-queries":<br>
>            action => rm;<br>
>     }<br>
><br>
> }<br>
><br>
><br>
> This type could check for values, and do :<br>
>    - set the value if the value is defined<br>
>    - rm the value if the value is not defined<br>
><br>
<br>
</div>This is very puppet-like: Have a well-built, tightly scoped low-level<br>
tool and "export" it by providing a separate, equally tightly scoped<br>
high-level define for a specific use case. It's similar to git's<br>
plumbing/porcelain split, although git has only one scope to look at,<br>
while puppet has many (conffile handling, managing<br>
{mysql,apache,mediawiki,postgres,exim,postfix,...}).<br>
</blockquote><div><br><br>Yes, I think the puppet interface to augeas has to be both really close to the augeas API, and fit for puppet usage.<br><br><br>Raphaël<br><br><br></div></div><br></div>