Puppet Function: pupmod::server_distribution
- Defined in:
- functions/server_distribution.pp
- Function type:
- Puppet Language
Overview
Figure out if we’re running PC1 or PE puppet
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 |
# File 'functions/server_distribution.pp', line 9
function pupmod::server_distribution (
Boolean $lookup_from_pupmod = true
){
# In Puppet 6.19 the section "master" was renamed to "server" in Puppet.settings.
# pick is used here to determine correct value for backwards compatability
$_puppet_user = pick(
$facts.dig('puppet_settings','server','user'),
$facts.dig('puppet_settings','master','user')
)
if fact('pe_build') or ( $_puppet_user == 'pe-puppet') {
$server_type = 'PE'
}
else {
if $lookup_from_pupmod {
# Just in case someone set these to what they *want* it to be:
$server_type = pick(
getvar('pupmod::server_distribution'),
simplib::lookup('simp_options::puppet::server_distribution', { 'default_value' => 'PC1' })
)
}
else {
$server_type = simplib::lookup('simp_options::puppet::server_distribution', { 'default_value' => 'PC1' })
}
}
$server_type
}
|