[augeas-devel] Help with cobbler lens

Bryan Kearney bkearney at redhat.com
Sat Dec 19 14:27:02 UTC 2009


On 12/18/2009 04:25 PM, David Lutterkort wrote:
> On Fri, 2009-12-18 at 15:53 -0500, Bryan Kearney wrote:
>> On 12/18/2009 02:24 PM, David Lutterkort wrote:
>>> On Fri, 2009-12-18 at 08:45 -0500, Bryan Kearney wrote:
>>>> On 12/17/2009 03:39 PM, David Lutterkort wrote:
>>>>> On Thu, 2009-12-17 at 11:24 -0500, Bryan Kearney wrote:
>>>>>> I took a first cut at a cobblersettings lens. You can see it at [1]. It
>>>>>> is meant to parse cobbler settings files [2] which is a basic YAML 1.0
>>>>>> syntax. It parses fine, but I am having issues saving a nested
>>>>>> structure.
>>>>>
>>>>> When I run 'augparse cobblersettings.aug', I get a whole bunch of type
>>>>> errors - do you get them, too ? Those need to be fixed first ...
>>>>
>>>>
>>>> I see them. The error messages are a bit obscure and the lens seemed to
>>>> be working. Is there a FAQ on reading the error messages?
>>>
>>> Now there is:
>>> http://augeas.net/page/Ambiguities_or_what_do_those_error_messages_from_the_typechecker_mean
>>
>>
>> This was helpful. It may be good to explain the syntax of the error
>> message is
>>
>> line.column - line.column and the second line is omitted if it does not
>> change. I was too stupid to realize that.
>>
>> I am not sitting on this version of th lens:
>>
>> http://pastie.org/749121
>>
>> and get this error when I try and parse:
>>
>> Test run encountered exception:
>> cobblersettings.aug:50.11-53.31:exception: overlapping lenses in tree
>> union.put
>>       Example matched by both:  {  }
>>       First lens: cobblersettings.aug:50.11-52.42
>>       Second lens: cobblersettings.aug:48.29-.102
>
> setting_list_suffix and indented_list_suffix both match the empty tree
> { } - I doubt that that is entirely intentional; for setting_list_suffix
> you have:
>
>          let setting_list_suffix = lbr . [value_list] . rbr . eol
>
> value_list by itself creates a list of tree nodes. By encloding it in
> another [] you are creating a node with no label, whose children will be
> the list created by value_list.
>
> It seems more logical to me to give that node a name, e.g. with [label
> "list" . value_list], and do something similar for indented_list_suffix.
> I am not sure if there is any semantic difference between the notation
>
>    key: [value1, value2]
>
> and
>
>    key:
>       - value1
>       - value2
>

These are semantically the same which is the issue. I tried what you 
said and came away with http://www.pastie.org/749828. I think I am 
closer, but i am now getting the following errors 
http://www.pastie.org/749830.

In those errors.. what does the |=| mean? Is that the actual characters?

> in YAML, but for purposes of the lens you need to distinguish the two
> somehow in the tree. One way is to put the values for one form under a
> "list" node, and the other under a "sequence" node or some such. It
> should also be possible to put both under a "list" node, and put a
> "sequence" node as the first child of the "list", and the entries as
> further children of "list".

How would I add a child. Would I stick in a

[label '.foo']

in there?

-- bk




More information about the augeas-devel mailing list