Raphaël Pinson wrote:


On Fri, Aug 1, 2008 at 12:17 AM, Kjetil Torgrim Homme <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
<SNIP>

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 :) ).

Take a look at [1]. The changes property can take a single command, or many based on line breaks or bring an array. The thinking being that you would want to do dependency managment on a a single unit of work which could be more then one augeas call.



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;
    }

}


In the current implementation it would be:
$mysql_augeas_commands = [
        "set /files/etc/mysql.cnf/query_cache_limit $query_cache_limit",
        "rm /files/etc/my.cnf/log-slow-queries"
]

augeas {"mysql_changes":
        changes => $mysql_augeas_commands
}
        


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


Or there could be a keyword to tell the type to delete the value...


editfile { "/etc/ssh/sshd_config":

         lens => 'sshd,
         match => '/sshd/AcceptEnv/*',
         rm => 'match',
     }



using the xpath format directly in the action would lead to this aswell :

augeas { "/files/etc/ssh/sshd_config/sshd/AcceptEnv/*":
    action => rm;
}


I agree in principle, force them to understand the augeas syntax.


<snip>

Btw, I'm forwarding this conversation to the puppet-dev group to have more insight/ideas from other puppet experts.

thanks.. I am hoping to push this into the common modules when it is ready.


-- bk

[1] http://git.et.redhat.com/?p=ace.git;a=blob;f=modules/augeas/test.pp

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to