[augeas-devel] Ensuring a multi-value node has a value present

Andrew Beverley andy at andybev.com
Sun Jan 25 08:47:06 UTC 2015


Hi guys,

Firstly, thanks for Augeas. I've only just come across it, but it's
really useful!

I'm using Augeus to alter an sshd config file. For simple options, I can
just do (for example):

    set /files/etc/ssh/sshd_config/PermitRootLogin without-password

If it's not set, then it will be added, if it is set, then it will be
updated as required.

However, what if I want to ensure that a particular group is in
AllowGroups? I can do

    set /files/etc/ssh/sshd_config/AllowGroups/0 sshers

But that will only work if that's the only group I set.

Is there a way I can say "add this value if it doesn't already exist"?

I realise that I can check the value first (which is what I am doing
now) but it would be nice to be able to write an idempotent command.

Thanks,

Andy





More information about the augeas-devel mailing list