Puppet Function: openldap::flatten_indices

Defined in:
functions/flatten_indices.pp
Function type:
Puppet Language

Overview

openldap::flatten_indices(Optional[Array[OpenLDAP::Index, 1]] $values)Optional[Array[String, 1]]

Flatten an array of index directives to an array of strings.

Examples:

openldap::flatten_indices([[['entryCSN', 'entryUUID'], ['eq']]])

Parameters:

  • values (Optional[Array[OpenLDAP::Index, 1]])

    The array of index directives.

Returns:

  • (Optional[Array[String, 1]])

    The array of flattened strings.

Since:

  • 2.0.0



11
12
13
14
15
16
17
18
19
20
21
22
# File 'functions/flatten_indices.pp', line 11

function openldap::flatten_indices(Optional[Array[OpenLDAP::Index, 1]] $values) {

  $values ? {
    undef   => undef,
    default => $values.map |OpenLDAP::Index $value| {
      size($value) ? {
        1       => "${join($value[0], ',')}",
        default => "${join($value[0], ',')} ${join($value[1], ',')}",
      }
    }
  }
}