Puppet Function: tp::get_version

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

Overview

tp::get_version(String $_ensure = '', Optional[String] $_version = undef, Hash $_settings = {}, Enum['full', 'major'] $_version_type = 'full')Any

Function tp::get_version. Get the package version based on input

Parameters:

  • _ensure (String) (defaults to: '')
  • _version (Optional[String]) (defaults to: undef)
  • _settings (Hash) (defaults to: {})
  • _version_type (Enum['full', 'major']) (defaults to: 'full')

Returns:

  • (Any)


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

function tp::get_version (
  String $_ensure = '',
  Optional[String] $_version = undef,
  Hash $_settings = {},
  Enum['full', 'major'] $_version_type = 'full',
) {
  if $_version_type == 'major' {
    $real_version = pick_default(getvar('_settings.release.latest_version_major'))
  } elsif $_version != undef and $_ensure != 'absent' {
    $real_version = $_version
  } elsif $_ensure !~ /^present$|^latest$|^absent$/ {
    $real_version = $_ensure
  } elsif getvar('_settings.release.latest_version') {
    $real_version = getvar('_settings.release.latest_version')
  } else {
    $real_version = ''
  }

  return $real_version
}