summaryrefslogtreecommitdiff
path: root/manifests/clone.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-05-14 20:13:36 +0200
committermh <mh@immerda.ch>2009-05-14 20:13:36 +0200
commit52f6c79d82018d96f1609f8c6c47e9d156d26893 (patch)
tree492cecb736e5bd6a0565cf0a88e2ff10a890d9af /manifests/clone.pp
parent941ed0e7577bee4d9b04c3211ddf8c70a858cf31 (diff)
splitted everything up in one file per class/define
Diffstat (limited to 'manifests/clone.pp')
-rw-r--r--manifests/clone.pp37
1 files changed, 37 insertions, 0 deletions
diff --git a/manifests/clone.pp b/manifests/clone.pp
new file mode 100644
index 0000000..bfc8082
--- /dev/null
+++ b/manifests/clone.pp
@@ -0,0 +1,37 @@
+define git::clone(
+ $ensure = present,
+ $git_repo,
+ $projectroot,
+ $cloneddir_user='root',
+ $cloneddir_group='0',
+ $cloneddir_restrict_mode=true
+){
+ 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}"],
+ }
+ }
+ }
+ }
+}