[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] Path and increasing identifiers



[ adding augeas-devel back to CC, got dropped somehow ]

On Wed, 2009-12-16 at 20:51 +0100, Tim Stoop wrote:
> On Wed, Dec 16, 2009 at 5:45 PM, David Lutterkort <lutter redhat com> wrote:
> > For numbered nodes (like the ones underneath /files/etc/hosts) the
> > easiest is to just use numbers that start with a '0', since Augeas will
> > never use such numbers, i.e. 01, 02 etc. will always be unique.
> 
> Are there any plans to provide support for actual number-based action
> for numbered nodes?
> 
> My problem with using numbers as a unique identifier of data is that
> it requires me to keep track of a list somewhere. With hosts, this
> could be easy (we could use 192168001010 for 192.168.1.10, I presume),
> but there are others, like the Debian supplied interfaces.aug, that
> uses a count to keep track of unique identifiers for data, instead of
> using the data itself in some way. I don't see an easy way around that
> and I expect my few hours of looking at several lenses isn't enough to
> uncover every application of it to see if they are solvable.
> 
> It would be nice if I could use these numerical identifiers in a way
> that doesn't require me to keep track of a list of unique identifiers
> for data that should in itself already have some form of uniqueness.
> Any tips are appreciated, of course!

The only place where you care about those numbered identifiers is when
you need to create new nodes - for that the whole 01, 02 etc. business
is an adequate solution.

For searching the tree, you can already use path expressions to
basically ignore the concrete numbering, i.e., you can say

  /files/etc/hosts/*[ipaddr='192.168.0.1']/canonical

to look up the canonical name of the entry in /etc/hosts with IP address
192.168.0.1; IOW, you can use the 'natural' unique identifier for data.

If that doesn't cover what you had in mind, maybe an example will help
me understand ;)

David




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]