From c3219f002c323561ca07f3fda36ebf2ad172a00a Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Wed, 12 Apr 2017 17:47:09 +0000
Subject: [PATCH] stack/logrotate: Allow we define frequency, nocompress and
 rotate

  This change allow us simplify accross the instances usage of logrotate
---
 stack/logrotate/buildout.hash.cfg              | 4 ++--
 stack/logrotate/instance-logrotate-base.cfg.in | 6 ++++++
 stack/logrotate/logrotate_entry.in             | 9 +++++----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/stack/logrotate/buildout.hash.cfg b/stack/logrotate/buildout.hash.cfg
index 9e7b82304..bdc8a7603 100644
--- a/stack/logrotate/buildout.hash.cfg
+++ b/stack/logrotate/buildout.hash.cfg
@@ -19,8 +19,8 @@ md5sum = 67954c82a8030e5dcac3a8c5d115f624
 
 [logrotate-entry-template]
 filename = logrotate_entry.in
-md5sum = 7a5ec8f141c61826a14db8619acba314
+md5sum = 71462fcd0a97b3ccc7b6ac6af6b2ca1e
 
 [template-logrotate-base]
 filename = instance-logrotate-base.cfg.in
-md5sum = 26dbc499413f9140b08fa20541d0db0f
+md5sum = c786f73c2a99390a5fad8aa3e01de627
diff --git a/stack/logrotate/instance-logrotate-base.cfg.in b/stack/logrotate/instance-logrotate-base.cfg.in
index bf25a6248..009c464e7 100644
--- a/stack/logrotate/instance-logrotate-base.cfg.in
+++ b/stack/logrotate/instance-logrotate-base.cfg.in
@@ -44,8 +44,14 @@ context =
   key log :log
   key post :post
   key pre :pre
+  key frequency :frequency
+  key rotate_num :rotate-num
+  key nocompress :nocompress
 post =
 pre =
+frequency = daily
+rotate-num = 3650
+nocompress = 
 
 [logrotate]
 recipe = slapos.cookbook:wrapper
diff --git a/stack/logrotate/logrotate_entry.in b/stack/logrotate/logrotate_entry.in
index 22d9c28da..338b8f575 100644
--- a/stack/logrotate/logrotate_entry.in
+++ b/stack/logrotate/logrotate_entry.in
@@ -1,9 +1,10 @@
 {{ log }} {
-  daily
+  {{ frequency }}
   dateext
-  rotate 3650
-  compress
-  delaycompress
+  rotate {{ rotate_num }}
+  {% if nocompress %}nocompress
+  {% else %}compress
+  delaycompress{% endif %}
   notifempty
   sharedscripts
   create
-- 
2.30.9