Puppet Function: peadm::certname
- Defined in:
- functions/certname.pp
- Function type:
- Puppet Language
Summary
Return the certname of the given target-like inputOverview
This function accepts a variety of data types which could represent single targets, and returns the certname corresponding to the input.
For Target objects, or arrays of a single Target object, a “certname” var can be set, which determines that target’s certname. Otherwise, the target’s name is its certname. For strings, the certname is equal to the string. Undef input returns undef.
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 45 46 47 |
# File 'functions/certname.pp', line 10
function peadm::certname(
Variant[Target,
String,
Undef,
Array[Target,1,1],
Array[String,1,1],
Array[Undef,1,1],
Array[Any,0,0]] $target,
) >> Variant[String, Undef] {
# lint:ignore:unquoted_string_in_case
case $target {
Target: {
$target.vars['certname'] ? {
default => $target.vars['certname'],
undef => $target.name
}
}
Array[Target,1,1]: {
$target[0].vars['certname'] ? {
default => $target[0].vars['certname'],
undef => $target[0].name
}
# lint:endignore
}
String: {
$target
}
Array[String,1,1]: {
$target[0]
}
Undef, Array[Undef,1,1], Array[Any,0,0]: {
undef
}
default: {
fail('Unexpected input type to peadm::certname function')
}
}
}
|