Puppet Function: ferm::join_hosts

Defined in:
modules/ferm/functions/join_hosts.pp
Function type:
Puppet Language

Summary

merges a list of IP addresses and hosts to a format Ferm understands

Overview

ferm::join_hosts(Firewall::Hosts $input)String

SPDX-License-Identifier: Apache-2.0

Parameters:

  • input (Firewall::Hosts)

Returns:



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'modules/ferm/functions/join_hosts.pp', line 3

function ferm::join_hosts (
  Firewall::Hosts $input,
) >> String {
  if $input =~ String {
    $input
  } else {
    $parts = $input.map |$input| {
      $input ? {
        Stdlib::IP::Address => $input,
        Ferm::Variable      => $input,
        default             => dnsquery::lookup($input, true)
      }
    }.flatten.sort.join(' ')

    "(${parts})"
  }
}