Puppet Function: wmflib::service::get_pool_nodes

Defined in:
modules/wmflib/functions/service/get_pool_nodes.pp
Function type:
Puppet Language

Overview

wmflib::service::get_pool_nodes(String $pool)Array[String]

Parameters:

Returns:



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
# File 'modules/wmflib/functions/service/get_pool_nodes.pp', line 1

function wmflib::service::get_pool_nodes(String $pool) >> Array[String] {
    # TODO: this is a bit hard-coded
    include wmflib::service::conftool

    $pool_data = wmflib::service::fetch(true)[$pool]
    if $pool_data == undef {
        fail("Could not find a definition for pool '${pool}'")
    }
    $conftool_cluster = $pool_data['lvs']['conftool']['cluster']
    $conftool_service = $pool_data['lvs']['conftool']['service']
    $cluster_nodes = $wmflib::service::conftool::site_nodes[$conftool_cluster]
    if $cluster_nodes == undef {
        fail("Could not find the conftool cluster '${cluster}' in site '${::site}' (pool '${pool}')")
    }
    $cluster_nodes.map |$node, $services| {
        if $conftool_service in $services {
            $node
        }
        else {
            undef
        }
    }
    .filter |$node| {
        $node != undef
    }
}