Defined Type: phabricator::logmail

Defined in:
modules/phabricator/manifests/logmail.pp

Overview

Parameters:

  • sndr_address (String)
  • rcpt_address (Variant[String, Array])
  • mysql_slave (Stdlib::Fqdn)
  • mysql_slave_port (Stdlib::Port)
  • mysql_db_name (String)
  • basedir (Stdlib::Unixpath) (defaults to: '/usr/local/bin')
  • hour (Optional[Integer]) (defaults to: 0)
  • minute (Optional[Integer]) (defaults to: 0)
  • monthday (Optional[Integer]) (defaults to: undef)
  • weekday (Optional[Systemd::Timer::Weekday]) (defaults to: undef)
  • ensure (Wmflib::Ensure) (defaults to: 'present')


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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'modules/phabricator/manifests/logmail.pp', line 44

define phabricator::logmail (
    String $sndr_address,
    Variant[String, Array] $rcpt_address,
    Stdlib::Fqdn $mysql_slave,
    Stdlib::Port $mysql_slave_port,
    String $mysql_db_name,
    Stdlib::Unixpath $basedir  = '/usr/local/bin',
    Optional[Integer] $hour = 0,
    Optional[Integer] $minute = 0,
    Optional[Integer] $monthday = undef,
    Optional[Systemd::Timer::Weekday] $weekday = undef,
    Wmflib::Ensure $ensure = 'present',
) {

    ensure_packages(['mariadb-client'])

    file { "/etc/phab_${title}.conf":
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0550',
        content => template("phabricator/${title}.conf.erb"),
    }

    file { "${basedir}/${title}.sh":
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0550',
        content => file("phabricator/${title}.sh"),
    }

    if $weekday == undef {
        $real_weekday = ''
    } else {
        $real_weekday = "${weekday} "
    }

    if $monthday == undef {
        $real_monthday = '*'
    } else {
        $real_monthday = $monthday
    }

    systemd::timer::job { "phabricator_stats_job_${title}":
        ensure      => $ensure,
        user        => 'root',
        description => "phabricator statistics mail - ${title}",
        command     => "${basedir}/${title}.sh",
        interval    => {'start' => 'OnCalendar', 'interval' => "${real_weekday}*-*-${real_monthday} ${hour}:${minute}:00"},
    }
}