Puppet Function: wmflib::service::fetch

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

Overview

wmflib::service::fetch(Boolean $lvs_only = false)Hash[String, Wmflib::Service]

This function retrieves the services list from hiera. In the future, this function should include all validation that is not doable with basic puppet typing. Takes a Boolean parameter called lvs. If set to true, only LVS based services will be returned. If set to false, all services will be returned

Parameters:

  • lvs_only (Boolean) (defaults to: false)

Returns:

  • (Hash[String, Wmflib::Service])


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'modules/wmflib/functions/service/fetch.pp', line 7

function wmflib::service::fetch(
    Boolean $lvs_only=false,
) >> Hash[String, Wmflib::Service] {
    # Use when doing local development
    #$yaml = loadyaml('hieradata/common/service.yaml')
    #$catalog = $yaml['service::catalog']

    $catalog = lookup('service::catalog', {'default_value' => {}})
    wmflib::service::validate($catalog)
    if $lvs_only {
        return $catalog.filter |$service, $data| { has_key($data, 'lvs') }
    }
    return $catalog
}