aboutsummaryrefslogtreecommitdiffstats
path: root/modules/subversion/manifests
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2012-03-17 17:43:37 +0000
committerMichael Scherer <misc@mageia.org>2012-03-17 17:43:37 +0000
commit45f98f84866410567e4aac88c33fe34be86c412b (patch)
treeee7e0667dceed4dd4d93bc41fe10d0614d3c40b1 /modules/subversion/manifests
parentc4eac9f992cd9528cf00ae8711bc3543e4af28e0 (diff)
downloadpuppet-45f98f84866410567e4aac88c33fe34be86c412b.tar
puppet-45f98f84866410567e4aac88c33fe34be86c412b.tar.gz
puppet-45f98f84866410567e4aac88c33fe34be86c412b.tar.bz2
puppet-45f98f84866410567e4aac88c33fe34be86c412b.tar.xz
puppet-45f98f84866410567e4aac88c33fe34be86c412b.zip
split repository out of init.pp and clean it
Diffstat (limited to 'modules/subversion/manifests')
-rw-r--r--modules/subversion/manifests/init.pp130
-rw-r--r--modules/subversion/manifests/repository.pp130
2 files changed, 130 insertions, 130 deletions
diff --git a/modules/subversion/manifests/init.pp b/modules/subversion/manifests/init.pp
index 9d8c7992..f4b148db 100644
--- a/modules/subversion/manifests/init.pp
+++ b/modules/subversion/manifests/init.pp
@@ -107,136 +107,6 @@ class subversion {
}
-
# TODO
# deploy a cronjob to make a backup file ( ie, dump in some directory )
-
- # documentation :
- # 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
- # cia_post : send commits to cia.vc
- # cia_module : name of the module to send to cia.vc
- # cia_ignore_author : a regexp to ignore commits from some authors
- # no_binary : do not accept files with common binary extentions on this repository
- # restricted_to_user : restrict commits to select user
- # syntax_check : array of 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 )
-
- define repository ($group = "svn",
- $public = true,
- $commit_mail = '',
- $i18n_mail = '',
- $cia_post = true,
- $cia_module = 'default',
- $cia_ignore_author = '',
- $no_binary = false,
- $restricted_to_user = false,
- $syntax_check = '',
- $extract_dir = '') {
- # check permissions
- # http://svnbook.red-bean.com/nightly/fr/svn.serverconfig.multimethod.html
- # $name ==> directory of the repo
- include subversion::server
- # TODO set umask -> requires puppet 2.7.0
- # unfortunatly, umask is required
- # http://projects.puppetlabs.com/issues/4424
- exec { "/usr/local/bin/create_svn_repo.sh $name":
- user => root,
- group => $group,
- creates => "$name/hooks",
- require => Package['subversion-tools'],
- }
-
- file { "$name":
- group => $group,
- owner => root,
- mode => $public ? {
- true => 644,
- false => 640
- },
- ensure => directory
- }
-
- file { ["$name/hooks/pre-commit","$name/hooks/post-commit"]:
- mode => 755,
- content => template("subversion/hook_commit.sh"),
- require => Exec["/usr/local/bin/create_svn_repo.sh $name"],
- }
-
- file { ["$name/hooks/post-commit.d", "$name/hooks/pre-commit.d"]:
- ensure => directory,
- require => File["$name/hooks/pre-commit"],
- }
-
- file { "$name/hooks/pre-revprop-change":
- ensure => "$subversion::server::local_dir/pre-revprop-change",
- mode => 755,
- require => File["$name/hooks/pre-commit"],
- }
-
- if $restricted_to_user {
- subversion::hook::pre_commit { "$name|restricted_to_user":
- content => template("subversion/restricted_to_user"),
- }
- } else {
- file { "$name/hooks/pre-commit.d/restricted_to_user":
- ensure => absent,
- }
- }
-
- if $commit_mail {
- subversion::hook::post_commit { "$name|send_mail":
- content => template("subversion/hook_sendmail.pl"),
- require => [Package['perl-SVN-Notify-Config']],
- }
- } else {
- file { "$name/hooks/post-commit.d/send_mail":
- ensure => absent,
- }
- }
-
- if $cia_post {
- subversion::hook::post_commit { "$name|cia.vc":
- content => template("subversion/ciabot_svn.sh"),
- }
-
- } else {
- file { "$name/hooks/post-commit.d/cia.vc":
- ensure => absent,
- }
- }
-
- if $no_binary {
- pre_commit_link { "$name/hooks/pre-commit.d/no_binary": }
- } else {
- file { "$name/hooks/pre-commit.d/no_binary":
- ensure => absent,
- }
- }
-
- if $extract_dir {
- subversion::hook::post_commit {"$name|extract_dir":
- content => template("subversion/hook_extract.pl"),
- require => [Package['perl-SVN-Notify-Mirror']],
- }
- } else {
- file { "$name/hooks/post-commit.d/extract_dir":
- ensure => absent,
- }
- }
-
- pre_commit_link { "$name/hooks/pre-commit.d/no_empty_message": }
-
- pre_commit_link { "$name/hooks/pre-commit.d/no_root_commit": }
-
- if $syntax_check {
- $syntax_check_array = regsubst($syntax_check,'^',"$name/hooks/pre-commit.d/")
- pre_commit_link { $syntax_check_array: }
- }
- }
-
-
}
diff --git a/modules/subversion/manifests/repository.pp b/modules/subversion/manifests/repository.pp
new file mode 100644
index 00000000..7f2f8356
--- /dev/null
+++ b/modules/subversion/manifests/repository.pp
@@ -0,0 +1,130 @@
+# documentation :
+# 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
+# cia_post : send commits to cia.vc
+# cia_module : name of the module to send to cia.vc
+# cia_ignore_author : a regexp to ignore commits from some authors
+# no_binary : do not accept files with common binary extensions
+# on this repository
+# restricted_to_user : restrict commits to select user
+# syntax_check : array of 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 )
+
+define subversion::repository($group = 'svn',
+ $public = true,
+ $commit_mail = '',
+ $i18n_mail = '',
+ $cia_post = true,
+ $cia_module = 'default',
+ $cia_ignore_author = '',
+ $no_binary = false,
+ $restricted_to_user = false,
+ $syntax_check = '',
+ $extract_dir = '') {
+ # check permissions
+ # http://svnbook.red-bean.com/nightly/fr/svn.serverconfig.multimethod.html
+ # $name ==> directory of the repo
+ include subversion::server
+ # TODO set umask -> requires puppet 2.7.0
+ # unfortunatly, umask is required
+ # http://projects.puppetlabs.com/issues/4424
+ exec { "/usr/local/bin/create_svn_repo.sh $name":
+ user => 'root',
+ group => $group,
+ creates => "$name/hooks",
+ require => Package['subversion-tools'],
+ }
+
+ file { $name:
+ group => $group,
+ owner => 'root',
+ mode => $public ? {
+ true => 644,
+ false => 640,
+ },
+ ensure => directory
+ }
+
+ file { ["$name/hooks/pre-commit","$name/hooks/post-commit"]:
+ mode => '0755',
+ content => template('subversion/hook_commit.sh'),
+ require => Exec["/usr/local/bin/create_svn_repo.sh $name"],
+ }
+
+ file { ["$name/hooks/post-commit.d", "$name/hooks/pre-commit.d"]:
+ ensure => directory,
+ require => File["$name/hooks/pre-commit"],
+ }
+
+ file { "$name/hooks/pre-revprop-change":
+ ensure => "$subversion::server::local_dir/pre-revprop-change",
+ mode => '0755',
+ require => File["$name/hooks/pre-commit"],
+ }
+
+ if $restricted_to_user {
+ subversion::hook::pre_commit { "$name|restricted_to_user":
+ content => template('subversion/restricted_to_user'),
+ }
+ } else {
+ file { "$name/hooks/pre-commit.d/restricted_to_user":
+ ensure => absent,
+ }
+ }
+
+ if $commit_mail {
+ subversion::hook::post_commit { "$name|send_mail":
+ content => template('subversion/hook_sendmail.pl'),
+ require => Package['perl-SVN-Notify-Config'],
+ }
+ } else {
+ file { "$name/hooks/post-commit.d/send_mail":
+ ensure => absent,
+ }
+ }
+
+
+ if $cia_post {
+ subversion::hook::post_commit { "$name|cia.vc":
+ content => template('subversion/ciabot_svn.sh'),
+ }
+ } else {
+ file { "$name/hooks/post-commit.d/cia.vc":
+ ensure => absent,
+ }
+ }
+
+
+ if $no_binary {
+ pre_commit_link { "$name/hooks/pre-commit.d/no_binary": }
+ } else {
+ file { "$name/hooks/pre-commit.d/no_binary":
+ ensure => absent,
+ }
+ }
+
+ if $extract_dir {
+ subversion::hook::post_commit {"$name|extract_dir":
+ content => template('subversion/hook_extract.pl'),
+ require => [Package['perl-SVN-Notify-Mirror']],
+ }
+ } else {
+ file { "$name/hooks/post-commit.d/extract_dir":
+ ensure => absent,
+ }
+ }
+
+ pre_commit_link { "$name/hooks/pre-commit.d/no_empty_message": }
+
+ pre_commit_link { "$name/hooks/pre-commit.d/no_root_commit": }
+
+ if $syntax_check {
+ $syntax_check_array = regsubst($syntax_check,'^',"$name/hooks/pre-commit.d/")
+ pre_commit_link { $syntax_check_array: }
+ }
+}
+
+