[augeas-devel] Append a node to the tree

Remi Ferrand remi.ferrand at cc.in2p3.fr
Wed Feb 12 19:01:17 UTC 2014


Hi everybody,

Sorry for the noise if this is not the right place for beginners to ask for
help but I couldn't manage to find the "augeas" info or user list ...

I'm just starting to play with augeas and what I'm trying to do is fairly
simple: Add a groupname to the "AllowGroups" directive in
/etc/ssh/sshd_config.

I've tried something like this:

augtool> print /files/etc/ssh/sshd_config/AllowGroups/
/files/etc/ssh/sshd_config/AllowGroups
/files/etc/ssh/sshd_config/AllowGroups/1 = "root"

augtool> print /files/etc/ssh/sshd_config/AllowGroups/*[last()]
/files/etc/ssh/sshd_config/AllowGroups/1 = "root"

So as far as I understand, AllowGroups is mapped to an array with only one
entry.

augtool> set /files/etc/ssh/sshd_config/AllowGroups/*[last()+1] testgroup
error: Failed to execute command
Setting /files/etc/ssh/sshd_config/AllowGroups/*[last()+1] failed

... this fails. I translate it like "add the node *testgroup* after the
last element of the array AllowGroups" ... so I don't really understand
where is my mistake here.


I was reading documentation about "How to append a node to the tree" here:
https://github.com/hercules-team/augeas/wiki/Adding-nodes-to-the-tree and
it says "The predicate [last()+1] forces set to create a new node."

I'm stuck there and I don't have a lot of other ideas on how to do this
simple thing.

Any help would be very appreciated :-)

Thanks

Cheers

Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20140212/f7f0f0fc/attachment.htm>


More information about the augeas-devel mailing list