Puppet Function: pontoon::service_names
- Defined in:
- modules/pontoon/functions/service_names.pp
- Function type:
- Puppet Language
Summary
Map each service to its 'names'. Names include the service name itself and any configured discovery names.Overview
SPDX-License-Identifier: Apache-2.0
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 33 34 35 36 |
# File 'modules/pontoon/functions/service_names.pp', line 7
function pontoon::service_names(
Hash[String, Wmflib::Service] $services_config,
Array[String] $domains = ['discovery', 'svc.eqiad', 'svc.codfw'],
String $tld = 'wmnet',
) >> Hash[String, Array[String]] {
$t = $services_config.map |$service_name, $config| {
$disc_names = ('discovery' in $config) ? {
true => $config['discovery'].map |$el| { $el['dnsdisc'] },
false => [],
}
$aliases = ('aliases' in $config) ? {
true => $config['aliases'],
false => [],
}
$all_names = unique($disc_names + $aliases + $service_name)
$svc_names = $domains.map |$d| {
$all_names.map |$n| {
[ "${n}.${d}.${tld}" ]
}
}
[
$service_name,
$svc_names.flatten().sort(),
]
}
Hash($t)
}
|