Puppet Function: peadm::assert_supported_pe_version

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

Summary

Assert that the PE version given is supported by PEAdm

Overview

peadm::assert_supported_pe_version(String $version, Boolean $permit_unsafe_versions = false)Struct[{ 'supported' => Boolean }]

Parameters:

  • the (String)

    version number to check

  • version (String)
  • permit_unsafe_versions (Boolean) (defaults to: false)

Returns:

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

    true if the version is supported, raise error otherwise



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'functions/assert_supported_pe_version.pp', line 4

function peadm::assert_supported_pe_version (
  String $version,
  Boolean $permit_unsafe_versions = false,
) >> Struct[{ 'supported' => Boolean }] {
  $oldest = '2019.7'
  $newest = '2025.0'
  $supported = ($version =~ SemVerRange(">= ${oldest} <= ${newest}"))

  if $permit_unsafe_versions {
# lint:ignore:strict_indent
    warning(@("WARN"/L))
        WARNING: Permitting unsafe PE versions. This is not supported or tested.
        Proceeding with this action could result in a broken PE Infrastructure.
      | WARN
# lint:endignore
  }

  if (!$supported and $permit_unsafe_versions) {
# lint:ignore:strict_indent
    warning(@("WARN"/L))
        WARNING: PE version ${version} is NOT SUPPORTED!
      | WARN
# lint:endignore
  }
  elsif (!$supported) {
# lint:ignore:strict_indent
    fail(@("REASON"/L))
      This version of the puppetlabs-peadm module does not support PE ${version}.

      For PE versions older than ${oldest}, please check to see if version 1.x \
      or 2.x of the puppetlabs-peadm module supports your PE version.

      For PE versions newer than ${newest}, check to see if a new version of peadm \
      exists which supports that version of PE.

      | REASON
# lint:endignore
  }

  return({ 'supported' => $supported })
}