Puppet Function: debian::codename::require

Defined in:
modules/debian/functions/codename/require.pp
Function type:
Puppet Language

Overview

debian::codename::require(String $codename, Enum['==', '>=', '>', '<', '<=', '!='] $operator = '==')Boolean

Examples:

Assuming theses functions are compiled for a host running debian buster then

debian::codename::require('buster')  # pass/no action
debian::codename::compare('stretch') # fail()
debian::codename::compare('stretch', '<') # fail()
debian::codename::compare('stretch', '>') # pass/no action
debian::codename::compare('buster', '>=') # pass/no action
debian::codename::compare('buster', '<=') # pass/no action

Parameters:

  • codename (String)

    the codename you want to test against

  • operator (Enum['==', '>=', '>', '<', '<=', '!=']) (defaults to: '==')

    the comparison operator to us i.e

Returns:

  • (Boolean)

    result of the comparison



12
13
14
15
16
17
18
19
# File 'modules/debian/functions/codename/require.pp', line 12

function debian::codename::require (
    String                                 $codename,
    Enum['==', '>=', '>', '<', '<=', '!='] $operator = '==',
) {
    unless debian::codename::compare($codename, $operator) {
        fail("node codename does not meet requirement `${debian::codename()} ${operator} ${codename}`")
    }
}