aboutsummaryrefslogtreecommitdiffstats
path: root/modules/subversion
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-01-17 15:24:08 +0000
committerMichael Scherer <misc@mageia.org>2011-01-17 15:24:08 +0000
commit2256d3a476f4ee7e16d6e094fd4873a9d6756013 (patch)
tree6b9ff42d0f1de73bf39d0e42360949c4c29e757f /modules/subversion
parent182cac02836d68fe1df527c7c80aa06c2e91be0f (diff)
downloadpuppet-2256d3a476f4ee7e16d6e094fd4873a9d6756013.tar
puppet-2256d3a476f4ee7e16d6e094fd4873a9d6756013.tar.gz
puppet-2256d3a476f4ee7e16d6e094fd4873a9d6756013.tar.bz2
puppet-2256d3a476f4ee7e16d6e094fd4873a9d6756013.tar.xz
puppet-2256d3a476f4ee7e16d6e094fd4873a9d6756013.zip
add a new class to do a mirror of a svn reporitory ( for display purpose with viewvc or any others )
Diffstat (limited to 'modules/subversion')
-rw-r--r--modules/subversion/manifests/init.pp26
-rw-r--r--modules/subversion/templates/create_svn_mirror.sh13
2 files changed, 39 insertions, 0 deletions
diff --git a/modules/subversion/manifests/init.pp b/modules/subversion/manifests/init.pp
index 7f09b393..b5131cb5 100644
--- a/modules/subversion/manifests/init.pp
+++ b/modules/subversion/manifests/init.pp
@@ -273,4 +273,30 @@ class subversion {
minute => $refresh
}
}
+
+ class mirror {
+ include subversion::tools
+ file { "/usr/local/bin/create_svn_mirror.sh":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 755,
+ content => template('subversion/create_svn_mirror.sh')
+ }
+ }
+
+ define mirror_repository($source,
+ $refresh = '*/5') {
+ include subversion::mirror
+
+ exec { "/usr/local/bin/create_svn_mirror.sh $name $source":
+ creates => $name,
+ require => Package['subversion-tools']
+ }
+
+ cron { "update $name":
+ command => "/usr/bin/svnsync synchronize file://$name",
+ minute => $refresh,
+ }
+ }
}
diff --git a/modules/subversion/templates/create_svn_mirror.sh b/modules/subversion/templates/create_svn_mirror.sh
new file mode 100644
index 00000000..ab0ada1b
--- /dev/null
+++ b/modules/subversion/templates/create_svn_mirror.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+umask 0002
+LOCAL_REPOS=$1
+REMOTE_REPOS=$2
+svnadmin create $LOCAL_REPOS
+# needed, as svnsync complain otherwise :
+# svnsync: Repository has not been enabled to accept revision propchanges;
+# ask the administrator to create a pre-revprop-change hook
+ln -s /bin/true $LOCAL_REPOS/hooks/pre-revprop-change
+svnsync init file://$1 $2
+# do not sync now,
+# let cron do it or puppet will complain ( especially for long sync )
+#svnsync synchronize file://$1