[augeas-devel] aug_lens_get

Jakub Hrozek jhrozek at redhat.com
Tue Mar 24 18:09:22 UTC 2009


Hello,

after some discussion with David off-list, we agreed that Augeas should
grow the functionality to operate not only on files but also on any
arbitrary string input - think parsing text that comes from a DB or LDAP
or even input.

The attached patch implements this via an aug_lens_get() function that
is an addition to the public API. The parsed string goes into (newly
created) /augeas/text hierarchy, the node is specified as a parameter of
aug_lens. 

For example:
augtool> lens_get /test @Hosts "192.168.122.149 ipaserver server.ipadev"
augtool> print /augeas/text/test
/augeas/text/test
/augeas/text/test/1
/augeas/text/test/1/ipaddr = "192.168.122.149"
/augeas/text/test/1/canonical = "ipaserver"
/augeas/text/test/1/alias = "server.ipadev"
augtool> 


The next step would be an inverse function aug_lens_put() that actually
lets you modify the tree and squash it back into a string.

The patch is not completely correct - I spent some time trying to get it
right but figured that it would be faster to ask here..the thing is,
that it crashes on subsequent invocations (tested from augtool) on the
lns_get() call. 

Because it's on subsequent calls, I presume I'm reusing something I
shouldn't or similar..but I couldn't figure why myself quickly since all
lns_get() are parameters from user or local variables, so I thought it
might actually be better to ask Augeas hackers on this list.

Thanks for any comments,
Jakub

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-aug_lens_get.patch
Type: text/x-patch
Size: 6266 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20090324/aea605d8/attachment.bin>


More information about the augeas-devel mailing list