blob: d5197d025df316933bfd28308f2bf2ef8e172030 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
class git {
class common {
package { 'git-core':
}
}
class server inherits common {
$git_base_path = '/git/'
xinetd::service { "git":
content => template('git/xinetd')
}
file { "$git_base_path":
ensure => directory
}
# TODO
# define common syntax check, see svn
# proper policy : no-fast-forward
# no branch ?
# no binary
# no big file
# no empty commit message, no root
# automated push to another git repo ( see http://noone.org/blog/English/Computer/VCS/Thoughts%20on%20Gitorious%20and%20GitHub%20plus%20a%20useful%20git%20hook.futile
#
# how do we handle commit permission ?
}
define repository {
exec { "git init --bare $name":
creates => $name,
}
file { "$name/git-daemon-export-ok":
ensure => present,
requires => Exec["git init --bare $name"]
}
}
class client inherits common {
}
define snapshot($source, $refresh ='*/5', $user = 'root') {
include git::client
#TODO
# should handle branch -> clone -n + branch + checkout
# create a script
# Idealy, should be handled by vcsrepo https://github.com/bruce/puppet-vcsrepo
# once it is merged in puppet
exec { "/usr/bin/git clone $source $name":
creates => $name,
user => $user
}
cron { "update $name":
# FIXME no -q ?
command => "cd $name && /usr/bin/git pull",
user => $user,
minute => $refresh
}
}
}
|