From c4a0aff2af47d48ca1b41110274ebb3879c4b758 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Tue, 2 Feb 2016 17:07:21 -0500 Subject: [PATCH] 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. --- manifests/unattended_upgrades.pp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index ffb5fad..52d7542 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -11,6 +11,16 @@ class apt::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