Retrieving last modified node path (Was: [augeas-devel] First tests with aug mv)

Raphaël Pinson raphink at gmail.com
Fri Aug 8 14:02:46 UTC 2008


On Fri, Aug 1, 2008 at 11:55 PM, David Lutterkort <dlutter at redhat.com>wrote:

> On Fri, 2008-08-01 at 23:19 +0200, Raphaël Pinson wrote:
>
>
> > OK, so I guess what there is to code now is a set_last_created call,
> > and the functions that will guess the path to send it to the
> > function :)
> >
> > I was telling you earlier that I thought in tree_insert I could
> > probably use seg_parent to get the parent node of the PATH given to
> > tree_insert, and then go through all the children of this parent node
> > until I find the newly inserted tree. Do you confirm this is how to do
> > it?
>
> Yeah, that's roughly what needs to happen; at the end of tree_insert,
> you'd want to set last_segment(p)->tree to the newly created node and
> than call format_path(p) .. I think though that the
> aug_set("/augeas/tree/last_created", format_path(p)) should be called
> from aug_insert, not tree_insert, since you don't want that node to
> change when tree_insert is used internally.
>


So far, tree_insert is only used by aug_insert, but I see your point,
although I think any function that would use tree_insert (even internally)
potentially needs to grab the value of the inserted node if they want to do
something with it eventually. And the only want to do that is to have
tree_insert do the aug_set, or to modify the call to tree_insert (which is
fine if I'm not wrong since it's not part of the public API) to return this
info to aug_insert, which would in its turn do the aug_set call.


Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080808/68a73cf7/attachment.htm>


More information about the augeas-devel mailing list