-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathassert_supported_pe_version.pp
38 lines (32 loc) · 1.28 KB
/
assert_supported_pe_version.pp
1
2
3
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
# @summary Assert that the PE version given is supported by PEAdm
# @return [Boolean] true if the version is supported, raise error otherwise
# @param [String] the version number to check
function peadm::assert_supported_pe_version (
String $version,
Boolean $permit_unsafe_versions = false,
) >> Struct[{'supported' => Boolean}] {
$oldest = '2019.7'
$newest = '2021.6'
$supported = ($version =~ SemVerRange(">= ${oldest} <= ${newest}"))
if $permit_unsafe_versions {
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
}
if (!$supported and $permit_unsafe_versions) {
warning(@("WARN"/L))
WARNING: PE version ${version} is NOT SUPPORTED!
| WARN
}
elsif (!$supported) {
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
}
return({ 'supported' => $supported })
}