Puppet Function: netbase::services

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

Overview

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

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])


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

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)
        }
    }
}