From dd99646641ae4254be0ebde30b22b7a3e48e189e Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Thu, 4 Dec 2014 15:43:27 +0800 Subject: [PATCH] Handle the upgrade from ulogd to ulogd2 in jessie and later. Use augeas to handle modifying the existing ulogd2 logrotate config. Remove instead of purge ulogd because it deletes log files on purge. Remove the puppet installed logrotate config for ulogd. Eliminates mails like these: /etc/cron.daily/logrotate: error: ulogd2:1 duplicate log entry for /var/log/ulog/syslogemu.log --- modules/ferm/manifests/init.pp | 37 ++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/modules/ferm/manifests/init.pp b/modules/ferm/manifests/init.pp index 6d2d0c62d..7115b7c8f 100644 --- a/modules/ferm/manifests/init.pp +++ b/modules/ferm/manifests/init.pp @@ -16,8 +16,18 @@ class ferm { package { 'ferm': ensure => installed } - package { 'ulogd': - ensure => installed + if ($::lsbmajdistrelease >= 8) { + package { 'ulogd2': + ensure => installed + } + package { 'ulogd': + # Remove instead of purge ulogd because it deletes log files on purge. + ensure => absent + } + } else { + package { 'ulogd': + ensure => installed + } } service { 'ferm': @@ -82,10 +92,25 @@ class ferm { content => template('ferm/interfaces.conf.erb'), notify => Service['ferm'], } - file { '/etc/logrotate.d/ulogd': - source => 'puppet:///modules/ferm/logrotate-ulogd', - mode => '0444', - require => Package['debian.org'], + if ($::lsbmajdistrelease >= 8) { + augeas { 'logrotate_ulogd2': + context => '/files/etc/logrotate.d/ulogd2', + changes => [ + 'set rule/schedule daily', + 'set rule/delaycompress delaycompress', + 'set rule/rotate 10', + 'set rule/ifempty notifempty', + ], + } + file { '/etc/logrotate.d/ulogd': + ensure => absent, + } + } else { + file { '/etc/logrotate.d/ulogd': + source => 'puppet:///modules/ferm/logrotate-ulogd', + mode => '0444', + require => Package['debian.org'], + } } } -- 2.20.1