Puppet Function: peadm::fail_on_transport

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

Overview

peadm::fail_on_transport(TargetSpec $nodes, String $transport, String $message = 'This is not supported.')Any

Fails if any nodes have the chosen transport.

Useful for excluding PCP when it’s not appopriate

Parameters:

  • nodes (TargetSpec)
  • transport (String)
  • message (String) (defaults to: 'This is not supported.')

Returns:

  • (Any)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'functions/fail_on_transport.pp', line 5

function peadm::fail_on_transport (
  TargetSpec $nodes,
  String     $transport,
  String     $message = 'This is not supported.',
) {
  $targets = get_targets($nodes)
  $targets.each |$target| {
    if $target.protocol == $transport {
      fail_plan(
        "${target.name} uses ${transport} transport: ${message}",
        'unexpected-transport',
        {
          'target'    => $target,
          'transport' => $transport,
        }
      )
    }
  }
}