[augeas-devel] logrotate and prerotate/postrotate

David Lutterkort lutter at redhat.com
Fri Jun 5 17:28:03 UTC 2009


On Thu, 2009-06-04 at 14:27 +0200, Marc Fournier wrote:
> Hello,
> 
> I'm having trouble understanding how I'm supposed to declare/modify
> postrotate statements using augeas on logrotate files.
> 
> test_logrotate.aug works fine, but the following fails:
> 
> augtool> get /files/etc/logrotate.d/snmpd/rule/postrotate
> /files/etc/logrotate.d/snmpd/rule/postrotate =         /sbin/service snmpd condrestart 2> /dev/null > /dev/null || true
> 
> augtool> set /files/etc/logrotate.d/snmpd/rule/postrotate foobar
> augtool> save
> Saving failed

You're being hit by a double-whammy: the logrotate lens requires that
the value for postrotate ends with a newline, but augtool won't let you
include newlines in the value (if you try something like 'set /foo
"foobar\n"', the value in the tree will end with a '\' followed by an
'n'

I think the fix for this is twofold: change the logrotate lens to not
require '\n' at the end of a script (it can insert that by itself) and
make augtool interpret escape characters in strings.

David





More information about the augeas-devel mailing list