Puppet Function: bsdauth::flatten_servers
- Defined in:
- functions/flatten_servers.pp
- Function type:
- Puppet Language
Overview
Flatten an array of LDAP servers to an array of strings.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'functions/flatten_servers.pp', line 11
function bsdauth::flatten_servers(Array[BSDAuth::LDAP::Server, 1] $servers) {
$servers.map |Integer $i, BSDAuth::LDAP::Server $server| {
$prefix = $i ? {
0 => 'x-ldap-server',
default => "x-ldap-serveralt${$i - 1}",
}
# Strip off any trailing commas thanks to optional values
regsubst("${prefix}=${server[hostname]},${server[port]},${server[mode]},${server[version]}", ',+$', '')
}
}
|