Defined Type: planet::updatejob

Defined in:
modules/planet/manifests/updatejob.pp

Overview

defined type: a systemd timer for planet feed updates per language per default all feed updates run hourly but at a random minute for each language where the language prefix is the seed

Parameters:

  • https_proxy (Stdlib::Httpsurl)
  • planet_bin (Stdlib::Unixpath) (defaults to: '/usr/bin/rawdog')
  • planet_conf_dir (String) (defaults to: '/etc/rawdog')
  • planet_options (String) (defaults to: '-v -u -w')


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
# File 'modules/planet/manifests/updatejob.pp', line 4

define planet::updatejob (
    Stdlib::Httpsurl $https_proxy,
    Stdlib::Unixpath $planet_bin = '/usr/bin/rawdog',
    String $planet_conf_dir = '/etc/rawdog',
    String $planet_options = '-v -u -w',
){

    $planet_cmd = "${planet_bin} -d ${planet_conf_dir}/${title}/ ${planet_options}"

    $minute = Integer(seeded_rand(60, $title))

    systemd::timer::job { "planet-update-${title}":
        ensure          => 'present',
        user            => 'planet',
        description     => "Update feed content for Planet language version: ${title}",
        command         => $planet_cmd,
        environment     => { 'HTTPS_PROXY' => $https_proxy },
        interval        => [
            {
            'start'    => 'OnBootSec', # initially start the unit
            'interval' => '10sec',
            },{
            'start'    => 'OnCalendar',
            'interval' => "*-*-* *:${minute}:00", # then hourly at a random minute
            },
        ],
        logfile_basedir => '/var/log/planet',
        logfile_name    => "update-${title}.log",
        require         => [
            Class['planet::packages'],
            File['/var/log/planet'],
            File['/etc/sysusers.d/planet.conf'],
        ],
    }
}