aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/maintdb.pp
blob: 88920bd443b35689c0233c4c5aa7d49c83fd6531 (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
class buildsystem::maintdb {
    include buildsystem::var::maintdb
    include buildsystem::var::groups
    include buildsystem::var::webstatus
    include sudo

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

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

    file { $buildsystem::var::maintdb::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 { [$buildsystem::var::maintdb::dump,
            "${buildsystem::var::maintdb::dump}.new",
            $buildsystem::var::maintdb::unmaintained,
	    "${buildsystem::var::maintdb::unmaintained}.new"]:
        owner   => $buildsystem::var::maintdb::login,
        require => File["${buildsystem::var::webstatus::location}/data"],
    }

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

    apache::vhost::base { $buildsystem::var::maintdb::hostname:
        location => $buildsystem::var::maintdb::dbdir,
        content  => template('buildsystem/maintdb/vhost_maintdb.conf'),
    }
}