Puppet Function: netbase::services

Defined in:
modules/netbase/functions/services.pp
Function type:
Puppet Language

Summary

function to return a hash of service definitions

Overview

netbase::services(Variant[String,Array[String[1]]] $filter = [])Hash[String, Netbase::Service]

SPDX-License-Identifier: Apache-2.0

Parameters:

  • a

    list of services to return. if not provided all services are returned

  • filter (Variant[String,Array[String[1]]]) (defaults to: [])

Returns:

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


4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'modules/netbase/functions/services.pp', line 4

function netbase::services (
    Variant[String,Array[String[1]]] $filter = []
) >> Hash[String, Netbase::Service] {
    $_filter = Array($filter, true)
    include netbase
    if $filter.empty {
        $netbase::all_services
    } else {
        $netbase::all_services.filter |$item| {
            # check the service key and the aliases
            $item[0] in $_filter or ($item[1]['aliases'] and !$item[1]['aliases'].intersection($_filter).empty)
        }
    }
}