[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - Logrotate: process 'minsize 1M' rule



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=57b420aea2bc0b391aaf31618a3d7a0f53870946
Commit:        57b420aea2bc0b391aaf31618a3d7a0f53870946
Parent:        2ab030e8404366e596e8d3ce482294562ba4a4e8
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Mon Mar 9 16:02:05 2009 -0700
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Mon Mar 9 16:08:48 2009 -0700

Logrotate: process 'minsize 1M' rule

logrotate allows unit suffixes 'k', 'M' and 'G' for 'size' and 'minsize'
---
 lenses/logrotate.aug            |    6 +++---
 lenses/tests/test_logrotate.aug |    5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lenses/logrotate.aug b/lenses/logrotate.aug
index 809e92e..8199edb 100644
--- a/lenses/logrotate.aug
+++ b/lenses/logrotate.aug
@@ -18,7 +18,7 @@ module Logrotate =
    let eol = Util.del_str "\n"
    let num = /[0-9]+/
    let word = /[^,# \n\t{}]+/
-   
+   let size = num . /[kMG]?/
 
    (* define comments and empty lines *)
    let comment (indent:string) = [ label "#comment" . del /[ \t]*/ indent . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . eol ]
@@ -54,7 +54,7 @@ module Logrotate =
 		| select_to_eol "delaycompress" /(no)?delaycompress/ indent
 		| select_to_eol "ifempty" /(not)?ifempty/ indent
 		| select_to_eol "sharedscripts" /(no)?sharedscripts/ indent
-		| value_to_eol "size" word indent
+		| value_to_eol "size" size indent
 		| tabooext indent
 		| value_to_eol "olddir" word indent
 		| flag_to_eol "noolddir" indent
@@ -72,7 +72,7 @@ module Logrotate =
 		| select_to_eol "copy" /(no)?copy/ indent
 		| select_to_eol "copytruncate" /(no)?copytruncate/ indent
 		| value_to_eol "maxage" num indent
-		| value_to_eol "minsize" num indent
+		| value_to_eol "minsize" size indent
 		| select_to_eol "shred" /(no)?shred/ indent
 		| value_to_eol "shredcycles" num indent
 		| value_to_eol "start" num indent
diff --git a/lenses/tests/test_logrotate.aug b/lenses/tests/test_logrotate.aug
index 406a717..cc1eadf 100644
--- a/lenses/tests/test_logrotate.aug
+++ b/lenses/tests/test_logrotate.aug
@@ -133,3 +133,8 @@ include /etc/logrotate.d
       { "file" = "/var/log/file" }
       { "dateext" = "dateext" } }
 
+  (* Make sure 'minsize 1M' works *)
+  test Logrotate.lns get "/avr/log/wtmp {\n minsize 1M\n}\n" =
+  { "rule"
+      { "file" = "/avr/log/wtmp" }
+      { "minsize" = "1M" } }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]