Defined Type: profile::docker::reporter::report

Defined in:
modules/profile/manifests/docker/reporter/report.pp

Overview

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: 'present')

    ensurable parameter

  • frequency (Enum['daily', 'weekly']) (defaults to: 'weekly')

    either daily or weekly to indicate how often the timer should run

  • proxy (Optional[Stdlib::HTTPUrl]) (defaults to: undef)

    the http proxy to use, if any



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
# File 'modules/profile/manifests/docker/reporter/report.pp', line 5

define profile::docker::reporter::report(
    Wmflib::Ensure            $ensure    = 'present',
    Enum['daily', 'weekly']   $frequency = 'weekly',
    Optional[Stdlib::HTTPUrl] $proxy     = undef,
) {
    file { "/etc/docker-report/${title}_rules.ini":
        ensure => $ensure,
        owner  => 'root',
        group  => 'root',
        source => "puppet:///modules/profile/docker/reporter/${title}_rules.ini",
    }
    $hour = sprintf('%02d', fqdn_rand(24, $title))
    $environment = $proxy.then |$p| {{'http_proxy' => $p}}

    $interval = $frequency ? {
        'daily' => "*-*-* ${hour}:00:00",
        'weekly' => "Mon *-*-* ${hour}:00:00"
    }
    systemd::timer::job { "docker-reporter-${title}-images":
        ensure            => $ensure,
        description       => "Report on upgrades to ${title} images.",
        command           => "/usr/bin/docker-report --filter-file /etc/docker-report/${title}_rules.ini docker-registry.wikimedia.org",
        interval          => {'start' => 'OnCalendar', 'interval' => $interval},
        user              => 'root',
        environment       => $environment,
        syslog_identifier => "docker-report-${title}",
    }
}