---- 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? If the latter, should Augeas a) support all distros out of the box, b) have a conditional distro-dependent build, or c) push responsibility to package maintainers? Sorry if I'm hijacking a thread, or if my questions are too obtuse. _______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
