[augeas-devel] Augeas Merging Configuration

David Lutterkort lutter at redhat.com
Fri May 6 17:17:45 UTC 2011


Hi Christos,

On Fri, 2011-05-06 at 11:55 +0300, Christos Bountalis wrote:
> My name is Christos Bountalis,I just joined this list. I was about to begin
> coding a new tool from scratch for merging configurations files for openSUSE
> as a student project for Google Summer of Code 2011. Recently, however we
> got a suggestion about Augeas that found very interesting. So instead of
> writing a new application I am thinking of extending Augeas with the ability
> to merge configuration files.
> 
> If am i not wrong, this feature is not available in Augeas at the moment,
> right?

Yes, that is true.

> Well I just thought I should ask for your opinion on this matter. I would be
> more than grateful for any information and suggestions that could help me.

I would love to have that feature in Augeas. What do you think the user
interface for such a tool will be like ? Especially, what are the inputs
(individual values, file snippets, entire files) ?

One way to structure this is to add two functions to the Augeas API: one
to take a string and transform it into a tree using a specified lens. A
long time ago, we discussed something like this here, and there's an old
patch floating around that needs to be dusted off [1]

The other function should be one to merge two subtrees together,
something like

        int aug_merge(struct augeas *, const char *src, const char
        *dest)
        
where SRC and DEST are path expressions evaluating to exactly one node,
e.g.

        aug_merge(aug, "/text/newstuff", "/files/etc/oldstuff")

This would result in changing /files/etc/oldstuff being modified to
contain /text/newstuff for some suitable value of 'modified'.

Of course, merging two trees is an interesting exercise in its own
right; I haven't thought much about it, but I am sure there's plenty of
literature on the subject ;)

It's probably best to think a little more about how users will use your
tool, and then develop a merge algorithm based on that.

David

[1] https://www.redhat.com/archives/augeas-devel/2009-March/msg00195.html




More information about the augeas-devel mailing list