<div dir="ltr"><br><br><div class="gmail_quote">On Fri, Aug 1, 2008 at 2:24 PM, Dominique Dumont <span dir="ltr"><<a href="mailto:dominique.dumont@hp.com">dominique.dumont@hp.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Raphaël Pinson <<a href="mailto:raphink@gmail.com">raphink@gmail.com</a>> writes:<br>
<br>
> It is an array as it is from what I understand. If you have several Subsystem entries,<br>
> they will be represented as :<br>
> /files/etc/ssh/sshd_config/Subsystem[1] = "sftp /usr/lib/openssh/sftp-server"<br>
> /files/etc/ssh/sshd_config/Subsystem[2] = "internal-sftp /another/command"<br>
<br>
</div>Confirmed. This means that the path structure differs depending on the<br>
number of elements of the array... :-/<br>
</blockquote><div><br>Hence the discussion on <a href="https://www.redhat.com/archives/augeas-devel/2008-August/msg00002.html">https://www.redhat.com/archives/augeas-devel/2008-August/msg00002.html</a>, to be able to retrieve the exact path of a node after any modification of the tree.<br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">And this notation is only valid for "leaf". As "higher" level arrays like<br>

/etc/host/ use another notation even with only one element in the array:<br>
<br>
augtool> print /files/etc/hosts<br>
/files/etc/hosts<br>
/files/etc/hosts/1<br>
/files/etc/hosts/1/ipaddr = "<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>"<br>
/files/etc/hosts/1/canonical = "localhost"<br>
/files/etc/hosts/1/alias = "localhost"</blockquote><div><br><br>No, this is not another notation. /files/etc/hosts/1 and /files/etc/hosts/2 are not two /etc/hosts files ;) In the first case, Subsystem was declared using "label" (or most likely "key", which gives the same result), resulting in the same of the label being used to refer to an array of values. In the second case, "seq" was used because the file is only made of the same kind of entries. It could have been made into :<br>
<br>/files/etc/hosts/entry<br>/files/etc/hosts/entry/ipaddr = "<a href="http://127.0.0.1/" target="_blank">127.0.0.1</a>"<br>
/files/etc/hosts/entry/canonical = "localhost"<br>
/files/etc/hosts/entry/alias = "localhost"<br><br>which would then give trees like /files/etc/hosts/entry[1] and /files/etc/hosts/entry[2] in the case of multiple entries, but since there's only one kind of entry, it's really useless, hence the use of numbers only to refer to lines (although I'm not a big fan of "seq", I find it harder to parse the tree).<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> Although I think it could well be split into :<br><div class="Ih2E3d">
><br>
> { "Subsystem"<br>
>     { "name" = "sftp" }<br>
>     { "command" = "/usr/lib/openssh/sftp-server" } }<br>
> { "Subsystem"<br>
>     { "name" = "internal-sftp" }<br>
>     { "command" = "/another/command" } }<br>
><br>
> but that's another problem ;)<br>
<br>
</div>Actually, that's how I represent them in Config::Model::OpenSsh. I<br>
think the end user will be more interested in configuring Subsystem by<br>
names instead of dealing with "artificial" numbers. This gives a<br>
structure like:<br>
<div class="Ih2E3d"><br>
 Subsystem:sftp=/usr/lib/openssh/sftp-server<br>
</div> Subsystem:internal-sftp=/usr/lib/openssh/sftp-server<br>
<br>
and you can set them from command line using this subsystem name<br>
oriented notation:<br>
<br>
 $ config-edit -model Sshd  Subsystem:sftp=/usr/lib/openssh/sftp-server \<br>
   Subsystem:internal-sftp=/usr/lib/openssh/sftp-server</blockquote><div><br><br>That's not the way augeas would do it though. It would be more like :<br><br><br>sftp_subsystem = augeas.match("/files/etc/ssh/sshd_config/Subsystem/name", "sftp")<br>
internal_sftp_subsystem = augeas.match("/files/etc/ssh/sshd_config/Subsystem/name", "internal-sftp")<br><br><br>and then using the returned path to set/rm/mv etc.<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
But that's also another problem ;-)<br>
<div><div></div><div class="Wj3C7c"></div></div></blockquote><div><br>or another approach ;-)<br><br><br><br>Raphaël<br></div></div><br></div>