aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/maintdb.pp
blob: 6c36e8eb835927d291b3190916a2245554f1a59e (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
69
70
71
class buildsystem {
    class maintdb {
    	include sudo
        $maintdb_login = "maintdb"
        $maintdb_homedir = "/var/lib/maintdb"
        $maintdb_dbdir = "$maintdb_homedir/db"
        $maintdb_binpath = "/usr/local/sbin/maintdb"
        $maintdb_wrappath = "/usr/local/bin/wrapper.maintdb"
        $maintdb_dump = "/var/www/bs/data/maintdb.txt"
        $maintdb_unmaintained = "/var/www/bs/data/unmaintained.txt"

        user {"$maintdb_login":
            ensure => present,
            comment => "Maintainers database",
            managehome => true,
            shell => "/bin/bash",
            home => "$maintdb_homedir",
        }

        file { "$maintdb_homedir":
            ensure => directory,
            owner => "$maintdb_login",
            group => "$maintdb_login",
            mode => 711,
            require => User["$maintdb_login"],
        }

        file { "$maintdb_dbdir":
            ensure => directory,
            owner => "$maintdb_login",
            group => "$maintdb_login",
            mode => 711,
            require => User["$maintdb_login"],
        }

        file { "$maintdb_binpath":
            mode => 755,
            content => template("buildsystem/maintdb")
        }

        file { "$maintdb_wrappath":
            mode => 755,
            content => template("buildsystem/wrapper.maintdb")
        }

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

        file { ["$maintdb_dump","$maintdb_dump.new",
                "$maintdb_unmaintained","$maintdb_unmaintained.new"]:
            ensure => present,
            owner => $maintdb_login,
            mode => 644,
            require => File["/var/www/bs/data"],
        }

        cron { "update maintdb export":
            user => $maintdb_login,
            command => "$maintdb_binpath root get > $maintdb_dump.new; mv -f $maintdb_dump.new $maintdb_dump; grep ' nobody\$' $maintdb_dump | sed 's/ nobody\$//' > $maintdb_unmaintained.new; mv -f $maintdb_unmaintained.new $maintdb_unmaintained",
            minute => "*/30",
            require => User[$maintdb_login],
        }

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