public
Description: A Puppet module for managing subversion
Homepage:
Clone URL: git://github.com/lak/puppet-subversion.git
puppet-subversion / manifests / svnserve.pp
25501c0c » lak 2008-07-07 Adding copyright info 1 # Copyright (c) 2008, Luke Kanies, luke@madstop.com
2 #
3 # Permission to use, copy, modify, and/or distribute this software for any
4 # purpose with or without fee is hereby granted, provided that the above
5 # copyright notice and this permission notice appear in all copies.
6 #
7 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
0a8bd7d9 » lak 2007-08-17 Converting from bzr to git 15 # Serve subversion-based code from a local location. The job of this
16 # module is to check the data out from subversion and keep it up to
17 # date, especially useful for providing data to your Puppet server.
18 #
19 # Example usage:
20 # svnserve { dist:
21 # source => "https://reductivelabs.com/svn",
22 # path => "/dist",
23 # user => "puppet",
24 # password => "mypassword"
25 # }
26 define svnserve($source, $path, $user = false, $password = false) {
27 file { $path:
28 ensure => directory,
29 owner => root,
30 group => root
31 }
32 $svncmd = $user ? {
33 false => "/usr/bin/svn co --non-interactive $source/$name .",
34 default => "/usr/bin/svn co --non-interactive --username $user --password '$password' $source/$name ."
35 }
36 exec { "svnco-$name":
37 command => $svncmd,
38 cwd => $path,
39 require => File[$path],
40 creates => "$path/.svn"
41 }
42 exec { "svnupdate-$name":
43 command => "/usr/bin/svn update",
44 require => Exec["svnco-$name"],
45 onlyif => '/usr/bin/svn status -u --non-interactive | /bin/grep "\*"',
46 cwd => $path
47 }
48 }