aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/maintdb.pp
blob: 156821e1e40449852f7b770763a974b41f3e5e23 (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
class buildsystem::maintdb {
    include sudo
    $login = 'maintdb'
    $homedir = '/var/lib/maintdb'
    $dbdir = "$homedir/db"
    $binpath = '/usr/local/sbin/maintdb'
    $dump = '/var/www/bs/data/maintdb.txt'
    $unmaintained = '/var/www/bs/data/unmaintained.txt'

    user { $login:
        comment => 'Maintainers database',
        home    => $homedir,
    }

    file { [$homedir,$dbdir]:
        ensure  => directory,
        owner   => $login,
        group   => $login,
        mode    => '0711',
        require => User[$login],
    }

    file { $binpath:
        mode    => '0755',
        content => template('buildsystem/maintdb/maintdb.bin')
    }

    local_script { 'wrapper.maintdb':
        content => template('buildsystem/maintdb/wrapper.maintdb')
    }

    sudo::sudoers_config { 'maintdb':
        content => template('buildsystem/maintdb/sudoers.maintdb')
    }

    file { [$dump,"$dump.new",
            $unmaintained,"$unmaintained.new"]:
        owner   => $login,
        require => File['/var/www/bs/data'],
    }

    cron { 'update maintdb export':
        user    => $login,
        command => "$binpath root get > $dump.new; cp -f $dump.new $dump; grep ' nobody\$' $dump | sed 's/ nobody\$//' > $unmaintained.new; cp -f $unmaintained.new $unmaintained",
        minute  => '*/30',
        require => User[$login],
    }

    apache::vhost_base { "maintdb.$::domain":
        location => $dbdir,
        content  => template('buildsystem/maintdb/vhost_maintdb.conf'),
    }
}