Puppet Function: peadm::check_version_and_known_hosts

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

Summary

Checks PE verison and warns about setting r10k_known_hosts

Overview

peadm::check_version_and_known_hosts(String $current_version, String $target_version, Optional[Peadm::Known_hosts] $r10k_known_hosts = undef)Any

Checks if the current PE version is less than 2023.3.0 and the target version is greater than or equal to 2023.3.0 If both conditions are true and the r10k_known_hosts parameter is not defined, a warning message is displayed.

Parameters:

  • $current_version (String)

    The current PE version

  • $target_version (String)

    The target PE version

  • $r10k_known_hosts (Optional[Peadm::Known_hosts])

    The r10k_known_hosts parameter

  • current_version (String)
  • target_version (String)
  • r10k_known_hosts (Optional[Peadm::Known_hosts]) (defaults to: undef)

Returns:

  • (Any)


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

function peadm::check_version_and_known_hosts(
  String $current_version,
  String $target_version,
  Optional[Peadm::Known_hosts]      $r10k_known_hosts         = undef,
) {
  $version = '2023.3.0'
  $current_check = SemVer($current_version) < SemVer($version)
  $target_check = SemVer($target_version) >= SemVer($version)

  # lint:ignore:140chars
  if ($current_check and $target_check and $r10k_known_hosts == undef) {
    out::message( @(HEREDOC/n)
\nWARNING: Starting in PE 2023.3, SSH host key verification is required for Code Manager and r10k.\n
To enable host key verification, you must define the puppet_enterprise::profile::master::r10k_known_hosts parameter with an array of hashes containing "name", "type", and "key" to specify your hostname, key type, and public key for your remote host(s).\n
If you currently use SSH protocol to allow r10k to access your remote Git repository, your Code Manager or r10k code management tool cannot function until you define the r10k_known_hosts parameter.\n
Please refer to the Puppet Enterprise 2023.3 Upgrade cautions for more details.\n
HEREDOC
    )# lint:endignore
  }
}