On 10/07/2010 11:46 AM, Arnau Bria wrote:
> Hi all,
> 
> I'm changing my code and I'd like to control a entire tree by svn and
> not puppet fileserver (we're trying to decrease puppet load).
> So I've created a copule of execs, one for svn checkout the other for
> svn update.
> 
> svn checkout looks like:
> 
> exec {
>  'svn_check_out' :
>  cwd     => '/opt/localconf',
>  command => 'svn co svn://repo/ && touch /usr/local/lock/svn',
>  create  => '/usr/local/lock/svn',
>  require => Files['localconf'],
> }
> 
> 
> first question, which is the best way for controlling a checkout? Is my
> create "lock file" mode good enough? How do other admins mange this
> kind of situation?

I'd rather define a sensible creates (note the final "s") parameter
inside the checkout location, if that is at all possible, instead of
inventing an artificial flag.
This is even more important if you manage several svn checkouts like that.

> then my svn update looks like:
> 
> exec {
>  'svn_update' :
>  cwd     => '/opt/localconf',
>  command => 'svn up gLite3.1',
>  require => [Files['localconf'], Exec['svn_check_out']],
> }
> 
> 
> update needs checkout, but only once. So, I'm wondering if this code is
> correct, or if that require svn_check_out could be coded in other way.

This looks correct to me. Since you use "require" and not "subscribe and
refreshonly", this will lead to performing the "has checkout been made
yet" check first, then running the exec invariably, which is what you want.

> Finally, the "exec question" is:
> 
> how do you manage an exec that "depends" (unless) on 2 or more conditions?
> may I separate them in the unless with logical or (||)? 

Since the "onlyif" is executed in a shell (afaik), using shell operator
like || and && is perfectly legitimate.

I like to separate the commands into variables like
$package = "dpkg -l '$package*' | awk '\$1 ~ /ii/'"
$process = "..."
exec { "...": onlyif => "$package && $process" }

Regards,
Felix

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to