From 2d5bcee78344e58b38dadc778474264094837f96 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 24 Feb 2009 00:09:39 +0000 Subject: various improvements to git clone - code style - change permission only when requested (but that's default) - name execs according to define name, otherwise you'll get duplicate names! --- manifests/defines.pp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/manifests/defines.pp b/manifests/defines.pp index ab5375d..e5c7a17 100644 --- a/manifests/defines.pp +++ b/manifests/defines.pp @@ -51,24 +51,27 @@ define git::web::repo::lighttpd( } define git::clone( - $git_repo, - $projectroot, - $cloneddir_user='root', - $cloneddir_group='0' + $git_repo, + $projectroot, + $cloneddir_user='root', + $cloneddir_group='0', + $cloneddir_restrict_mode=true ){ - exec {"git-clone": - command => "git-clone --no-hardlinks $git_repo $projectroot", - creates => "$projectroot/.git", - user => root, - notify => [Exec["git-clone-chown"],Exec["git-clone-chmod"]] - } - exec {"git-clone-chown": - command => "chown -R ${cloneddir_user}:${cloneddir_group} $projectroot", - refreshonly => true - } - exec {"git-clone-chmod": - command => "chmod -R o-rwx $projectroot", - refreshonly => true + exec {"git-clone_${name}": + command => "git-clone --no-hardlinks ${git_repo} ${projectroot}", + creates => "$projectroot/.git", + notify => Exec["git-clone-chown"], + } + exec {"git-clone-chown_${name}": + command => "chown -R ${cloneddir_user}:${cloneddir_group} ${projectroot}", + refreshonly => true, + } + if $cloneddir_restrict_mode { + exec {"git-clone-chmod_${name}": + command => "chmod -R o-rwx ${projectroot}", + refreshonly => true, + subscribe => Exec["git-clone_${name}"], } + } } -- cgit v1.2.3