[augeas-devel] sshd lens bugfix

David Lutterkort lutter at redhat.com
Mon Feb 8 19:48:02 UTC 2010


On Thu, 2010-02-04 at 11:02 +0100, Thomas Bellman wrote:
> Dominique Dumont wrote:
> 
> > Le mardi 2 février 2010 19:30:46, David Lutterkort a écrit :
> 
> >> For example, the Grub.lns will split the kernel command line into
> >> individual args, since people frequently want to interrogate and change
> >> those individually. So, rephrasing my question: how important is that
> >> granularity for Sshd ?
> 
> > I can't say for myself as I don't use this feature.
> 
> > I've searched for examples on Google but I did not get many results, so I 
> > don't think this feature is much used. Hence this granularity is probably not 
> > important.
> 
> Problem is, it isn't a question of that one thing is convenient, and the
> other is inconvenient.  If you don't have the fine-grained granularity,
> some things become *impossible*.  In my opinion, there should be a fairly
> heavy bias towards making even the uncommon things possible, even if it
> makes common things more inconvenient.  (I'm not saying that we should
> make them possible at all costs, just that it inconvenience weight lighter
> than impossibility.)

That's kinda what I am leaning towards.

> This is extra important when you can't make the change to become more
> fine-granular without breaking backwards compatibility.  Then it becomes
> important to do it right as early as possible, or else wait until a new
> major release.

Yes, that is a very important issue (it's mitigated a little by the fact
that you can easily install your own lenses and override the ones that
come with Augeas, but that's a bandaid at best)

> The ideal solution would be to make it possible to have both, so if you
> did 'set .../foo "cmd arg1 arg2"', then it would automatically also update
> .../foo/arg[0], .../foo/arg[1] and .../foo/arg[2], and vice versa.  Then
> you get convenience in both cases, and it isn't quite so important to get
> the lenses perfect from the start.

One fairly easy way to achieve that would be to add commands that take a
string and turn it into a tree, and then move that tree to where you
need it; e.g., something like

        lens_get "cmd arg1 arg2" Sshd.subsystem /text
        ins Subsystem before /files/etc/sshd_config/Match[1]
        mv /text/Subsystem /files/etc/sshd_config/Subsystem[last()]
        
The lens_get would take a string, a lens, and a path; it then applies
the lens to the string to produce a tree, and puts that tree underneath
path in the global tree.

It's a little painful, and you now depend on that there is a
Sshd.subsystem lens that does what you need, but at least in a scripting
language, it wouldn't be too hard to hide that behind a utility
function.

David





More information about the augeas-devel mailing list