module-apt/manifests/unattended_upgrades.pp
Gabriel Filion c4a0aff2af Manage unattended-upgrades log directory
In some situations, the log directory for unattended-upgrades might not
exist. In those cases, packages will not get upgraded!

unattended-upgrades crashes with a python backtrace because the log dir
is not present.
2016-02-02 17:07:21 -05:00

34 lines
861 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
}
# For some reason, this directory is sometimes absent, which causes
# unattended-upgrades to crash.
file { '/var/log/unattended-upgrades':
ensure => directory,
owner => 'root',
group => 0,
mode => '0755',
require => Package['unattended-upgrades'],
}
$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
}
}