diff options
author | mh <mh@immerda.ch> | 2009-03-07 12:22:08 +0000 |
---|---|---|
committer | mh <mh@immerda.ch> | 2009-03-07 12:22:08 +0000 |
commit | 941ed0e7577bee4d9b04c3211ddf8c70a858cf31 (patch) | |
tree | f043e97b7a2d7392d99b228d08e2d358f7195ef8 /manifests | |
parent | 27c72fae8c2b92743f55133c0056d0f9a48c58cc (diff) |
we can now remove a git clone
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/defines.pp | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/manifests/defines.pp b/manifests/defines.pp index cab1930..d32f948 100644 --- a/manifests/defines.pp +++ b/manifests/defines.pp @@ -51,30 +51,40 @@ define git::web::repo::lighttpd( } define git::clone( + $ensure = present, $git_repo, $projectroot, $cloneddir_user='root', $cloneddir_group='0', $cloneddir_restrict_mode=true ){ - include git - - exec {"git-clone_${name}": - command => "git-clone --no-hardlinks ${git_repo} ${projectroot}", - creates => "${projectroot}/.git", - require => Package['git'], - notify => Exec["git-clone-chown_${name}"], - } - 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}"], + case $ensure { + absent: { + exec{"rm -rf $projectroot": + onlyif => "test -d $projectroot", + } } + default: { + include git + exec {"git-clone_${name}": + command => "git-clone --no-hardlinks ${git_repo} ${projectroot}", + creates => "${projectroot}/.git", + user => root, + require => Package['git'], + notify => Exec["git-clone-chown_${name}"], + } + 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}"], + } + } + } } } |