On Fri, 2008-08-01 at 14:24 +0200, Dominique Dumont wrote:
> > It is an array as it is from what I understand. If you have several 
> > Subsystem entries,
> > they will be represented as :
> > /files/etc/ssh/sshd_config/Subsystem[1] = "sftp 
> > /usr/lib/openssh/sftp-server"
> > /files/etc/ssh/sshd_config/Subsystem[2] = "internal-sftp /another/command"
> 
> Confirmed. This means that the path structure differs depending on the
> number of elements of the array... :-/

No, they don't. The '[1]' etc are not part of the node name, they are
used to distinguish between nodes with the same label.
So, /files/etc/ssh/sshd_config/Subsystem[1] will always give you the
first Subsystem node, as will
'/files[1]/etc[1]/ssh[1]/sshd_config[1]/Subsystem[1]' - it's just that
augtool doesn't print the [1] when it's not needed.

> And this notation is only valid for "leaf". As "higher" level arrays like
> /etc/host/ use another notation even with only one element in the array:
> 
> augtool> print /files/etc/hosts
> /files/etc/hosts
> /files/etc/hosts/1
> /files/etc/hosts/1/ipaddr = "127.0.0.1"
> /files/etc/hosts/1/canonical = "localhost"
> /files/etc/hosts/1/alias = "localhost"

It's two different ways of mapping array-like constructs into the tree:
lenses can either create multiple nodes with the same label, or use
'seq' to generate labels that are integers taken from a sequence.

The reason to use one or the other has to do with subtleties about how
whitespace/formatting is preserved, especially when you delete a subtree
in the middle of the file. My OLS paper[1] has an explanation of those.

> Actually, that's how I represent them in Config::Model::OpenSsh. I
> think the end user will be more interested in configuring Subsystem by
> names instead of dealing with "artificial" numbers. This gives a
> structure like:
> 
>  Subsystem:sftp=/usr/lib/openssh/sftp-server
>  Subsystem:internal-sftp=/usr/lib/openssh/sftp-server
> 
> and you can set them from command line using this subsystem name
> oriented notation:
> 
>  $ config-edit -model Sshd  Subsystem:sftp=/usr/lib/openssh/sftp-server \
>    Subsystem:internal-sftp=/usr/lib/openssh/sftp-server
> 
> But that's also another problem ;-)

I agree that that schema would make more sense in this case - I'd
appreciate if somebody would work up a patch for sshd.aug, otherwise
I'll try and do it some time next week.

David

[1]
http://ols.fedoraproject.org/OLS/Reprints-2008/lutterkort-reprint.pdf

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to