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

    mga-common::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["${buildsystem::var::webstatus::location}/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'),
    }
}