Page MenuHomeSoftware Heritage

entry.pp
No OneTemporary

entry.pp

define puppet::config::entry (
$key,
$value,
$section,
$sectionorder = 5,
$joiner = ',',
) {
if is_array($value) {
$_value = join(flatten($value), $joiner)
} elsif is_bool($value) {
$_value = bool2str($value)
} else {
$_value = $value
}
# note the spaces at he end of the 'order' parameters,
# they make sure that '1_main ' is ordered before '1_main_*'
ensure_resource('concat::fragment', "puppet.conf_${section}", {
target => "${::puppet::dir}/puppet.conf",
content => "\n\n[${section}]",
order => "${sectionorder}_${section} ",
})
# this adds the '$key =' for the first value,
# otherwise it just appends it with the joiner to separate it from the previous value.
if (!defined(Concat::Fragment["puppet.conf_${section}_${key}"])){
concat::fragment{"puppet.conf_${section}_${key}":
target => "${::puppet::dir}/puppet.conf",
content => "\n ${key} = ${_value}",
order => "${sectionorder}_${section}_${key} ",
}
} else {
concat::fragment{"puppet.conf_${section}_${key}_${name}":
target => "${::puppet::dir}/puppet.conf",
content => "${joiner}${_value}",
order => "${sectionorder}_${section}_${key}_${name} ",
}
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Aug 18, 7:37 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3460123

Event Timeline