On Fri, Feb 4, 2011 at 5:14 PM, Owen Mann <[email protected]> wrote:
> ---- Original message ----
>>Date: Fri, 4 Feb 2011 09:49:06 +0100
>>From: [email protected] (on behalf of Raphaël Pinson 
>><[email protected]>)
>>Subject: Re: [augeas-devel] How can I reverse the order of the parsed keys?
>>To: Francis Giraldeau <[email protected]>
>>Cc: augeas devel <[email protected]>
>>
>>Hello,
>>
>>
>>While Francis' method works, I think generally it is better for the
>>users to stick to the order in the conffiles, it will be less
>>confusing when they try to figure out how the lens works. The Xpath
>>syntax will then allow to filter on attributes rather than nodes if
>>necessary.
>>
>>
>>Raphaël
>>
>>
>>
>>
>>On Fri, Feb 4, 2011 at 6:17 AM, Francis Giraldeau
>><[email protected]> wrote:
>>> On Fri, 2011-02-04 at 16:39 +1300, Steve Shipway wrote:
>>>> What I'm trying to do is to parse an MRTG config file, which has lines
>>>> in this format:
>>>>
>>>>
>>>>
>>>> Directive[targetname]: value
>>>>
>>>>
>>>>
>>>> for some Directive, targetname and value.  This would be relatively
>>>> easy to parse into a format of ./Directive/targetname=value
>>>>
>>>>
>>>>
>>>> However, due to the nature of the configuration file, I'd like it to
>>>> appear in the /files tree in the format
>>>>
>>>>
>>>>
>>>> ./targetname/Directive = value
>>>>
>>>>
>>>>
>>>> I can't see a way to do this, since Augeas appears to process the file
>>>> strictly in one direction only.
>>>
>>> Yeah, but there is a twist if you list targetnames. But that depends on
>>> the situation.
>>>
>>> module Mrtg =
>>>
>>> (* d[t] :v *)
>>>
>>> let dels (s:string) = del s s
>>>
>>> let record (targetname:string) = [ label targetname . [ key /[a-z]+/ .
>>> dels "[" . dels targetname . dels "]:" . store /[a-z]+/ ] ]
>>>
>>> let cfg = record "foo" | record "bar"
>>>
>>> test cfg get "somedirective[foo]:somevalue" = { "foo" { "somedirective"
>>> = "somevalue" }}
>>>
>>> Francis
>>>
>>>
>>> _______________________________________________
>>> augeas-devel mailing list
>>> [email protected]
>>> https://www.redhat.com/mailman/listinfo/augeas-devel
>>
>>_______________________________________________
>>augeas-devel mailing list
>>[email protected]
>>https://www.redhat.com/mailman/listinfo/augeas-devel
>
> For me, this begs a "big picture" question: Is abstracting differences in 
> implementation a goal of Augeas?
> For instance, an IP address of eth0 on Redhat has the key:
> /files/etc/sysconfig/network-scripts/ifcfg-eth0/IPADDR = "10.10.10.23"
>
> On Gentoo, the key would be:
> /files/etc/conf.d/net/config_eth0/1 = "\"10.10.10.23/24\""
>
> Should Augeas try to correlate different implementations, or should there be 
> completely >independent distribution-dependent lenses, and keys?

The former.

The goal of Augeas is to parse and write config files. Lenses might
might check the contents of the fields by restricting the regexps used
to parse the files, but the goal is not to "understand" the intended
configuration. Thus, it does not intend for example to provide a
unified way to manipulate network configurations on various systems.

On the subject of manipulating network configurations on various
distributions, David actually started another project called NetCF
[0], which makes use of Augeas as a parser/writer and provides an
abstracted view of network configurations, mapped to the Augeas tree
on various distributions.

There are other tools which can use Augeas as a low-level parser and
provide a higher interface to checkproof or otherwise validate
configurations, such as Config::Model [1].


Raphaël



[0] https://fedorahosted.org/netcf/
[1] http://sourceforge.net/projects/config-model/

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to