Puppet Function: peadm::assert_supported_bolt_version

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

Summary

Assert that the Bolt executable running PEAdm is a supported version

Overview

peadm::assert_supported_bolt_version()Struct[{ 'supported' => Boolean }]

Checks if the current Bolt version matches the SemVerRange defined in $supported_bolt_version Fails the calling plan if false, does nothing if true. Accepts a parameter for the $supported_bolt_version for unit testing purposes

Returns:

  • (Struct[{ 'supported' => Boolean }])


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

function peadm::assert_supported_bolt_version (
  # No arguments
) >> Struct[{ 'supported' => Boolean }] {
  $supported_bolt_version = '>= 3.17.0 < 5.0.0'
  $supported = (peadm::bolt_version() =~ SemVerRange($supported_bolt_version))
# lint:ignore:strict_indent
  unless $supported {
    fail(@("REASON"/L))
      This version of puppetlabs-peadm requires Bolt version ${supported_bolt_version}.

      You are using Bolt version ${peadm::bolt_version()}.

      Please make sure you have a compatible Bolt version and try again.

      | REASON
  }
# lint:endignore
  return({ 'supported' => $supported })
}