1 |
class buildsystem::maintdb { |
2 |
include sudo |
3 |
$login = 'maintdb' |
4 |
$homedir = '/var/lib/maintdb' |
5 |
$dbdir = "$homedir/db" |
6 |
$binpath = '/usr/local/sbin/maintdb' |
7 |
$dump = '/var/www/bs/data/maintdb.txt' |
8 |
$unmaintained = '/var/www/bs/data/unmaintained.txt' |
9 |
|
10 |
user { $login: |
11 |
comment => 'Maintainers database', |
12 |
home => $homedir, |
13 |
} |
14 |
|
15 |
file { [$homedir,$dbdir]: |
16 |
ensure => directory, |
17 |
owner => $login, |
18 |
group => $login, |
19 |
mode => '0711', |
20 |
require => User[$login], |
21 |
} |
22 |
|
23 |
file { $binpath: |
24 |
mode => '0755', |
25 |
content => template('buildsystem/maintdb/maintdb.bin') |
26 |
} |
27 |
|
28 |
local_script { 'wrapper.maintdb': |
29 |
content => template('buildsystem/maintdb/wrapper.maintdb') |
30 |
} |
31 |
|
32 |
sudo::sudoers_config { 'maintdb': |
33 |
content => template('buildsystem/maintdb/sudoers.maintdb') |
34 |
} |
35 |
|
36 |
file { [$dump,"$dump.new", |
37 |
$unmaintained,"$unmaintained.new"]: |
38 |
owner => $login, |
39 |
# TODO uncomment once the situation with pkgsubmit module is cleared ( ie, maintdb depend on it ) |
40 |
# require => File['/var/www/bs/data'], |
41 |
} |
42 |
|
43 |
cron { 'update maintdb export': |
44 |
user => $login, |
45 |
command => "$binpath root get > $dump.new; cp -f $dump.new $dump; grep ' nobody\$' $dump | sed 's/ nobody\$//' > $unmaintained.new; cp -f $unmaintained.new $unmaintained", |
46 |
minute => '*/30', |
47 |
require => User[$login], |
48 |
} |
49 |
|
50 |
apache::vhost::base { "maintdb.$::domain": |
51 |
location => $dbdir, |
52 |
content => template('buildsystem/maintdb/vhost_maintdb.conf'), |
53 |
} |
54 |
} |