e714859a10
Micah found an issue with usage of config_content: if you call template('...') yourself and pass that on to config_content, then your template gets evaluated without all of the variables. This means that you don't hava access to blacklisted_packages, mail_recipient or mailonlyonerror. To make it possible to use a different template while still having access to those variables, let's make it possible to change the template name that we're using.
24 lines
574 B
Puppet
24 lines
574 B
Puppet
class apt::unattended_upgrades (
|
|
$config_content = undef,
|
|
$config_template = 'apt/50unattended-upgrades.erb',
|
|
$mailonlyonerror = true,
|
|
$mail_recipient = 'root',
|
|
$blacklisted_packages = [],
|
|
$ensure_version = present
|
|
) {
|
|
|
|
package { 'unattended-upgrades':
|
|
ensure => $ensure_version
|
|
}
|
|
|
|
$file_content = $config_content ? {
|
|
undef => template($config_template),
|
|
default => $config_content
|
|
}
|
|
|
|
apt_conf { '50unattended-upgrades':
|
|
content => $file_content,
|
|
require => Package['unattended-upgrades'],
|
|
refresh_apt => false
|
|
}
|
|
}
|