From e4c746f1c068a10e0725cd6019ee692b9f0c07e7 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Fri, 23 Jan 2015 09:43:14 -0500 Subject: [PATCH] loadbalancer: Use logrotate define for haproxy * logrotate::rule instead of file * remove haproxy logrotate file Change-Id: I8294108710d6335bca871bad294ff561ccd2c47b --- files/logrotate/haproxy | 12 ------------ manifests/loadbalancer.pp | 14 ++++++++------ spec/classes/cloud_loadbalancer_spec.rb | 17 ++++++++++------- 3 files changed, 18 insertions(+), 25 deletions(-) delete mode 100644 files/logrotate/haproxy diff --git a/files/logrotate/haproxy b/files/logrotate/haproxy deleted file mode 100644 index 0e2d7045..00000000 --- a/files/logrotate/haproxy +++ /dev/null @@ -1,12 +0,0 @@ -# Managed by Puppet -# Module cloud::loadbalancer -/var/log/haproxy.log { - rotate 7 - daily - missingok - notifempty - delaycompress - compress - postrotate - endscript -} diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index 8cbf2f67..390e3169 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -563,12 +563,14 @@ class cloud::loadbalancer( } } - file { '/etc/logrotate.d/haproxy': - ensure => file, - source => 'puppet:///modules/cloud/logrotate/haproxy', - owner => root, - group => root, - mode => '0644'; + logrotate::rule { 'haproxy': + path => '/var/log/haproxy.log', + rotate => 7, + rotate_every => 'day', + missingok => true, + ifempty => false, + delaycompress => true, + compress => true, } if $vip_monitor_ip { diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index b957ddae..6534dcd5 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -195,14 +195,17 @@ describe 'cloud::loadbalancer' do end # configure haproxy server end # configure keepalived in master - context 'configure logrotate file' do - it { is_expected.to contain_file('/etc/logrotate.d/haproxy').with( - :source => 'puppet:///modules/cloud/logrotate/haproxy', - :mode => '0644', - :owner => 'root', - :group => 'root' + context 'configure logrotate rule' do + it { is_expected.to contain_logrotate__rule('haproxy').with( + :path => '/var/log/haproxy.log', + :rotate => 7, + :rotate_every => 'day', + :missingok => true, + :ifempty => false, + :delaycompress => true, + :compress => true )} - end # configure logrotate file + end # configure logrotate rule context 'configure monitor haproxy listen' do it { is_expected.to contain_haproxy__listen('monitor').with(