aboutsummaryrefslogtreecommitdiffstats
path: root/modules/buildsystem/manifests/scheduler.pp
blob: 47ac036e32589aa36000eb6137b2ab0b6394b397 (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
class buildsystem::scheduler {
        # until ulri is splitted from main iurt rpm
        include buildsystem::iurt::packages
        include buildsystem::iurt::upload
        include buildsystem::var::scheduler

        $login = $buildsystem::var::scheduler::login
        $homedir = $buildsystem::var::scheduler::homedir
        $logdir = $buildsystem::var::scheduler::logdir

        buildsystem::sshuser { $login:
            homedir => $homedir,
        }

        file { $logdir:
            ensure => directory,
            mode   => '0755',
            owner  => $login,
        }

        cron { 'dispatch jobs':
            user    => $login,
            command => "EMI_LOG_FILE=${logdir}/emi.log ULRI_LOG_FILE=${logdir}/ulri.log ulri; EMI_LOG_FILE=${logdir}/emi.log emi",
            minute  => '*',
        }

        if ($buildsystem::var::scheduler::clean_uploads_logs_age != '0') {
            tidy { "${buildsystem::var::scheduler::homedir}/uploads":
                type    => 'ctime',
                recurse => true,
                age     => $buildsystem::var::scheduler::clean_uploads_logs_age,
                rmdirs  => true,
            }
        }
        if ($buildsystem::var::scheduler::clean_uploads_packages_age != '0') {
            tidy { "${buildsystem::var::scheduler::homedir}/uploads/**/*.rpm":
                path    => "${buildsystem::var::scheduler::homedir}/uploads",
                type    => 'ctime',
                recurse => true,
                age     => $buildsystem::var::scheduler::clean_uploads_packages_age,
                matches => [ '*.rpm' ],
            }
        }
}