[Mageia-sysadm] [714] - change syntax for pre_commit_link, to avoid duplicated names

root at mageia.org root at mageia.org
Fri Jan 7 21:12:01 CET 2011


Revision: 714
Author:   boklm
Date:     2011-01-07 21:12:01 +0100 (Fri, 07 Jan 2011)
Log Message:
-----------
- change syntax for pre_commit_link, to avoid duplicated names
- remove syntax_check array and replace by multiple arguments as I can't find any way to avoid duplicate names when using an array

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

Modified: puppet/manifests/nodes.pp
===================================================================
--- puppet/manifests/nodes.pp	2011-01-07 19:44:26 UTC (rev 713)
+++ puppet/manifests/nodes.pp	2011-01-07 20:12:01 UTC (rev 714)
@@ -29,7 +29,8 @@
     subversion::repository { "/svn/adm/":
         group => "mga-sysadmin",
         commit_mail => ['mageia-sysadm at mageia.org', "sysadmin-commits at ml.$domain"],
-        syntax_check => ['check_puppet_templates','check_puppet'],
+	syntax_check1 => 'check_puppet_templates',
+	syntax_check2 => 'check_puppet',
 	cia_post => true,
 	cia_module => "mageia-sysadm",
     }

Modified: puppet/modules/subversion/manifests/init.pp
===================================================================
--- puppet/modules/subversion/manifests/init.pp	2011-01-07 19:44:26 UTC (rev 713)
+++ puppet/modules/subversion/manifests/init.pp	2011-01-07 20:12:01 UTC (rev 714)
@@ -98,10 +98,9 @@
 
    
     # FIXME ugly
-    define pre_commit_link($directory) {
-	file { "pre_commit_link-$directory/${name}":
-	    path => "$directory/$name",
-	    ensure => "/usr/local/share/subversion/pre-commit.d/$name",
+    define pre_commit_link($scriptname) {
+	file { "${name}":
+	    ensure => "/usr/local/share/subversion/pre-commit.d/$scriptname",
 	    owner => root,
 	    group => root,
 	    mode => 755,
@@ -115,7 +114,9 @@
     #    group : group that have commit access on the svn
     #    public : boolean if the svn is readable by anybody or not
     #    commit_mail : array of people who will receive mail after each commit
-    #    syntax_check : array of pre-commit script with syntax check to add
+    #    syntax_check1 : pre-commit script with syntax check to add
+    #    syntax_check2 : pre-commit script with syntax check to add
+    #    syntax_check3 : pre-commit script with syntax check to add
     #    extract_dir : hash of directory to update upon commit ( with svn update ), 
     #            initial checkout is not handled, nor the permission
     #            TODO, handle the tags ( see svn::notify::mirror )
@@ -126,7 +127,9 @@
                        $cia_post = true,
                        $cia_module = 'default',
 		       $no_binary = false,
-                       $syntax_check = '',
+                       $syntax_check1 = '',
+                       $syntax_check2 = '',
+                       $syntax_check3 = '',
                        $extract_dir = '') {
         # check permissions
         # http://svnbook.red-bean.com/nightly/fr/svn.serverconfig.multimethod.html
@@ -192,8 +195,8 @@
 	}
 
 	if $no_binary {
-	    pre_commit_link { 'no_binary': 
-		directory => "$name/hooks/pre-commit.d/"
+	    pre_commit_link { '$name/hooks/pre-commit.d/no_binary': 
+		scriptname => 'no_binary',
 	    }
 	}
 
@@ -209,8 +212,29 @@
         }
 
 	pre_commit_link { ['no_empty_message','no_root_commit', $syntax_check]: 
-		directory => "$name/hooks/pre-commit.d/"
+	    directory => "$name/hooks/pre-commit.d/"
 	}
+	pre_commit_link { "$name/hooks/post-commit.d/no_empty_message":
+	    scriptname => 'no_empty_message',
+	}
+	pre_commit_link { "$name/hooks/post-commit.d/no_root_commit":
+	    scriptname => 'no_root_commit',
+	}
+	if $syntax_check1 {
+	    pre_commit_link { "$name/hooks/post-commit.d/${syntax_check1}":
+	        scriptname => $syntax_check1,
+	    }
+	}
+	if $syntax_check2 {
+	    pre_commit_link { "$name/hooks/post-commit.d/${syntax_check2}":
+		scriptname => $syntax_check2,
+	    }
+	}
+	if $syntax_check3 {
+	    pre_commit_link { "$name/hooks/post-commit.d/${syntax_check3}":
+		scriptname => $syntax_check3,
+	    }
+	}
     }
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110107/ebf3a00a/attachment.html>


More information about the Mageia-sysadm mailing list