[Mageia-sysadm] [813] add a new class to do a mirror of a svn reporitory ( for display purpose with viewvc or any others )

root at mageia.org root at mageia.org
Mon Jan 17 16:24:09 CET 2011


Revision: 813
Author:   misc
Date:     2011-01-17 16:24:08 +0100 (Mon, 17 Jan 2011)
Log Message:
-----------
add a new class to do a mirror of a svn reporitory ( for display purpose with viewvc or any others )

Modified Paths:
--------------
    puppet/modules/subversion/manifests/init.pp

Added Paths:
-----------
    puppet/modules/subversion/templates/create_svn_mirror.sh

Modified: puppet/modules/subversion/manifests/init.pp
===================================================================
--- puppet/modules/subversion/manifests/init.pp	2011-01-17 15:24:07 UTC (rev 812)
+++ puppet/modules/subversion/manifests/init.pp	2011-01-17 15:24:08 UTC (rev 813)
@@ -273,4 +273,30 @@
            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,
+        }   
+    } 
 }

Added: puppet/modules/subversion/templates/create_svn_mirror.sh
===================================================================
--- puppet/modules/subversion/templates/create_svn_mirror.sh	                        (rev 0)
+++ puppet/modules/subversion/templates/create_svn_mirror.sh	2011-01-17 15:24:08 UTC (rev 813)
@@ -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110117/690dd1ec/attachment-0001.html>


More information about the Mageia-sysadm mailing list