Puppet Function: wmflib::service::get_services_for

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

Overview

wmflib::service::get_services_for(Enum['discovery'] $what)Hash[String, Wmflib::Service]

Select services that are active for this specific request. Allowed arguments are:

  • discovery, will return all services that have a discovery stanza and are in the right status.

Parameters:

  • what (Enum['discovery'])

Returns:

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


4
5
6
7
8
9
10
11
12
13
# File 'modules/wmflib/functions/service/get_services_for.pp', line 4

function wmflib::service::get_services_for(Enum['discovery'] $what) >> Hash[String, Wmflib::Service] {
  if $what == 'discovery' {
      $needed_properties = ['discovery']
      $needed_statuses = ['production']
  }
  wmflib::service::fetch().filter |$name, $srv| {
      $present = $srv.keys.filter |$k| {$k in $needed_properties}
      ($srv['state'] in $needed_statuses and $present != [])
  }
}