Puppet Class: mediawiki::nutcracker::yaml_defs

Defined in:
modules/mediawiki/manifests/nutcracker/yaml_defs.pp

Overview

Parameters:

  • path (Stdlib::Unixpath) (defaults to: undef)
  • redis_shards (Hash) (defaults to: {})
  • nutcracker_ports (Hash) (defaults to: { 'eqiad' => 12000, 'codfw' => 12001})


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/mediawiki/manifests/nutcracker/yaml_defs.pp', line 6

class mediawiki::nutcracker::yaml_defs(
    Stdlib::Unixpath $path = undef,
    Hash $redis_shards    = {},
    Hash $nutcracker_ports = { 'eqiad' => 12000, 'codfw' => 12001},

){
    $pools = $redis_shards['sessions'].map |$datacenter, $servers| {
        {
            'name' => $datacenter,
            'port' => $nutcracker_ports[$datacenter],
            'servers' =>  $servers.map |$shard_slot, $hostinfo| {
                {
                    'shard' => $shard_slot,
                    'host'  => $hostinfo['host'],
                    'port'  => $hostinfo['port']
                }
                },
        }
    }
    file { $path:
        ensure  => present,
        content => to_yaml({'mw' => {'nutcracker' => {'pools' => $pools}}}),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }
}