[augeas-devel] Use of Record Sequences
David Lutterkort
dlutter at redhat.com
Thu Feb 28 17:45:53 UTC 2008
On Thu, 2008-02-28 at 10:59 -0500, Bryan Kearney wrote:
>
> David Lutterkort wrote:
> >
> > Yes, you can. That's what the key lens does, an example of that is in
> > yum.aug. 'key RE' for some regular expression RE matches that regular
> > expression against the file during parsing and uses it as the label of
> > the enclosing tree (marked with '[' .. ']')
>
> So.. can I assume the best practice would be to use the sequence iff
> there is no logical key?
Yes, if there's no clear primary key for something, use the sequence.
> >
> > Since many config files don't have natural primary keys for their
> > entries, Augeas lets you generate synthetic keys with 'seq NAME' and
> > then find entries with match. For example, to find the entry for
> > initdefault in /etc/inittab, you'd do
> >
> > match /system/config/inittab/*/action initdefault
> >
>
> I guess I am achoring on xPath.. so this would match all the action
> nodes. Is that the expected bahaviour?
Even simpler than that: it does an fnmatch, i.e. is more like file
system globbing (actually, aug_match returns a list of all nodes
matching that pattern; augtool is the one filtering by value and
printing only those paths whose value is 'initdefault')
David
More information about the augeas-devel
mailing list