[augeas-devel] Lenses Interfaces not generating correct syntax

David Lutterkort lutter at redhat.com
Fri Apr 24 18:23:14 UTC 2009


On Fri, 2009-04-24 at 09:28 +0200, Nicolas Turpault wrote:
> I try to use Augeas to generate configuration files but I have 2 
> problems with the interfaces lenses.

Just for the record: what version of Augeas are you using ? And what
platform ?

> - If I use the following code:
> augtool> set /files/etc/network/interfaces/iface[1] lo
> augtool> set /files/etc/network/interfaces/iface[1]/family inet
> augtool> set /files/etc/network/interfaces/iface[1]/method loopback
> augtool> save
> /usr/share/augeas/lenses/interfaces.aug:76.16-80.67:Short split for concat
> Saving failed
> 
> I have the folling error and the interfaces files is not generate :
> 
> /usr/share/augeas/lenses/interfaces.aug:76.16-80.67:Short split for concat
> Saving failed

Yeah, that's an error in the lens since it makes a comment after the
interface mandatory; I'll look into fixing that.

> I have to add a command to generate the files, it's not a very important 
> error but when we see the lences it seems that the comment is optionnal.

It absolutely should be

> - My second problem is also with comment,
> With the following code:
> augtool> set /files/etc/network/interfaces/iface[1] lo
> augtool> set /files/etc/network/interfaces/iface[1]/family inet
> augtool> set /files/etc/network/interfaces/iface[1]/method loopback
> augtool> set /files/etc/network/interfaces/iface[1]/#comment lo
> augtool> save
> Saved 1 file(s)
> 
> It generate the following file:
> iface lo inet loopback# lo

Yeah, that's a problem with comment - it accepts whitespace before the
'#' when it parses, but when you write a completely new node out, it
doesn't add a comment.

To fix that, we probably have to distinguish between a comment that's an
entire line (in which case we don't want a space before the '#' by
default) and an end-of-line comment where we do want that.

David





More information about the augeas-devel mailing list