/[adm]/puppet/modules/git/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/git/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2500 - (show annotations) (download)
Thu Mar 15 22:55:12 2012 UTC (12 years, 1 month ago) by misc
File size: 2303 byte(s)
clean git module, and some partial splitting
1 class git {
2 define mirror($source,
3 $description,
4 $refresh = '*/5') {
5
6 exec { "/usr/bin/git clone --bare $source $name":
7 alias => "git mirror $name",
8 creates => $name,
9 before => File["$name/description"],
10 }
11
12 file { "$name/description":
13 content => $description,
14 }
15
16 cron { "update $name":
17 command => "cd $name ; /usr/bin/git fetch -q",
18 minute => $refresh
19 }
20 }
21
22 define svn_repository($source,
23 $std_layout = true,
24 $refresh = '*/5') {
25 include git::svn
26 include git::server
27 # a cron job
28 # a exec
29 if $std_layout {
30 $options = '-s'
31 } else {
32 $options = ''
33 }
34
35 exec { "/usr/bin/git svn init $options $source $name":
36 alias => "git svn $name",
37 creates => $name,
38 }
39
40 file { '/usr/local/bin/update_git_svn.sh':
41 mode => '0755',
42 source => 'puppet:///modules/git/update_git_svn.sh',
43 }
44
45 cron { "update $name":
46 # done in 2 times, so fetch can fill the repo after init
47 command => "/usr/local/bin/update_git_svn.sh $name" ,
48 minute => $refresh
49 }
50
51 file { "$name/.git/hooks/pre-receive":
52 mode => '0755',
53 content => template('git/pre-receive'),
54 require => Exec["git svn $name"]
55 }
56 }
57
58 class client inherits common {
59
60
61 }
62
63 class svn inherits client {
64 package { 'git-svn': }
65 }
66
67 define snapshot($source, $refresh ='*/5', $user = 'root') {
68 include git::client
69 #TODO
70 # should handle branch -> clone -n + branch + checkout
71 # create a script
72 # Idealy, should be handled by vcsrepo https://github.com/bruce/puppet-vcsrepo
73 # once it is merged in puppet
74 exec { "/usr/bin/git clone $source $name":
75 creates => $name,
76 user => $user
77 }
78
79 cron { "update $name":
80 # FIXME no -q ?
81 command => "cd $name && /usr/bin/git pull",
82 user => $user,
83 minute => $refresh
84 }
85 }
86 }

  ViewVC Help
Powered by ViewVC 1.1.30