aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/maintdb.pp
blob: 022aed6b775fafc9418e0ad524b1fcebdd8f36e2 (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
class buildsystem {
    class 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":
            ensure => present,
            comment => "Maintainers database",
            managehome => true,
            shell => "/bin/bash",
            home => "$homedir",
        }

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

        file { "$binpath":
            mode => 755,
            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"]:
            ensure => present,
            owner => $login,
            mode => 644,
            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"),
        }
    }
}