source: trunk/puppet/modules/puppet-svn/manifests/checkout.pp @ 761

Last change on this file since 761 was 625, checked in by sebas@…, 15 years ago

fork del modulo puppet svn

File size: 1.4 KB
Line 
1# Serve subversion-based code from a local location.  The job of this
2# module is to check the data out from subversion and keep it up to
3# date
4#
5# Example usage:
6#   svn::checkout { dist:
7#       repository => "https://reductivelabs.com/svn",
8#       svnparms = "--someparameter=AAAA --other parameter",
9#       local_path => "/dist",
10#       local_name => "mycheckout"
11#       user => "puppet",
12#       password => "mypassword"
13#   }
14define svn::checkout($repository, $local_path, $local_name = false, $user = false, $password = false) {
15
16  include svn
17
18  $local_name_real = $local_name ? { false => $name, default => $local_name }
19
20#   package { ["subversion"]: ensure => installed }
21
22#  file { $local_path:
23#    ensure => directory,
24#    owner => root,
25#    group => root
26#  }
27
28  $svnparms = $user ? {
29    false   => "--non-interactive",
30    default => "--non-interactive --username '$user' --password '$password'",
31  }
32
33  $svncmd = "/usr/bin/svn $svnparms"
34 
35  exec { "svn_co_$name":
36    command => "$svncmd checkout '$repository' '$local_name_real'",
37    cwd => $local_path,
38    creates => "$local_path/$local_name_real/.svn",
39#    require => Package ["subversion"],
40#    package { "subversion": ensure => installed }
41  }
42
43  exec { "svn_update_$name":
44    command => "$svncmd update '$local_name_real'",
45    cwd => $local_path,
46    require => Exec["svn_co_$name"],
47    onlyif => "$svncmd status -u '$local_name_real' | /bin/grep -E \"\*|\!\"",
48  }
49}
Note: See TracBrowser for help on using the repository browser.