[augeas-devel] Lenses Interfaces not generating correct syntax

Nicolas Turpault n.turpault at alphalink.fr
Mon Apr 27 14:23:53 UTC 2009


Hello,

I continue to test augeas and I just see today that the syntax is not 
correct when we add a comment in the same line than the "iface". At the 
startup networking return the following error : "too many parameters for 
iface line" (in Debian Lenny).


So we can remove the comment for the iface or add this comment before, 
but maybe the comment in option is sufficient.

I just see another problem in the lense ; it force an option in the 
iface and for example the line "iface lo inet loopback" is correct and 
doesn't need any option.


So for me the correct way to build a iface is:

let iface   = [ stanza_id    "iface"
               . stanza_param "family"
               . stanza_param "method" . eol
               . (stanza_option|comment|empty)* ]


Best regards,

Nicolas.


Nicolas Turpault wrote:
> David Lutterkort wrote:
>> 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 ?
>>
> I'm using the package from Debian testing (0.4.0).
> 
>>> - 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.
>>
> 
> ok. Thanks for your answer, if I have something pretty to fix this I 
> just let you know.
> 
>> David
>>
>>
> 
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel




More information about the augeas-devel mailing list