[augeas-devel] Re: [config-model-users] Semantic problem in augeas sshd lens ?

Dominique Dumont dominique.dumont at hp.com
Wed Sep 10 16:36:35 UTC 2008


David Lutterkort <dlutter at redhat.com> writes:

> I agree with that, and thought about removing 'seq' completely at some
> point. The reason it's still there has to do with how whitespace is
> preserved: if you have two lines in your /etc/hosts and you do a
> 'rm /files/etc/hosts/1', the remaining line will be restored exactly as
> it was before, because the whitespace for it is keyed off the label of
> the node ('2' when using 'seq')
>
> If you don't use seq and use multiple 'entry' labels instead, and you do
> 'rm /files/etc/hosts/entry[1]', when you save the tree, the remaining
> line will use the whitespace from the first line, since for multiple
> identical labels, the whitespace  is put on a list, and that list is
> consulted in order as entries are restored.

[ 6 weeks after, I've finally understood your example :o) ]

I've some idea on how to make API user's life simpler. Please read on ...

Let's take an example extracted from sshd_config:

    AcceptEnv LC_PAPER LC_NAME 
    AcceptEnv LC_ADDRESS LC_TELEPHONE

is converted by a lens that contain a seq to:

    /files/etc/ssh/sshd_config/AcceptEnv[0]/1/ =  LC_PAPER
    /files/etc/ssh/sshd_config/AcceptEnv[0]/2/ =  LC_NAME
    /files/etc/ssh/sshd_config/AcceptEnv[1]/3/ =  LC_ADDRESS
    /files/etc/ssh/sshd_config/AcceptEnv[1]/4/ =  LC_TELEPHONE

>From a semantic point of view, only the second index (/1/, /2/, ...)
is important. 

The first index that group the AcceptEnv entry ([0] [1]) is used only
to restore AcceptEnv by group in sshd_config file. They don't hold
semantic information.

Would it be possible to mask these index from the API user ?

For this, Augeas would need to mask the index of a lens that contain a
'seq' lens.

This way the above sshd_config entries would be expressed as:

    /files/etc/ssh/sshd_config/AcceptEnv[1] =  LC_PAPER
    /files/etc/ssh/sshd_config/AcceptEnv[2] =  LC_NAME
    /files/etc/ssh/sshd_config/AcceptEnv[3] =  LC_ADDRESS
    /files/etc/ssh/sshd_config/AcceptEnv[4] =  LC_TELEPHONE

But the above grouping would be restored in sshd_config file since
Augeas would keep track of the masked indexes.

Of course the lens definition will still need to specify the 'seq'
lens. 

Do I make sense ?

All the best.

-- 
Dominique Dumont 
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner




More information about the augeas-devel mailing list