[augeas-devel] Append to the last parameter in multiple entries

David Lutterkort lutter at redhat.com
Thu Jun 17 14:07:24 UTC 2010


Hi Brandon,

On Wed, 2010-05-26 at 16:39 -0400, Brandon Whalen wrote:
> I tried this:
> set /files/etc/httpd/conf/httpd.conf/<Directory[*]/Options/param[last()+1] -ExecCGI
> 
> And it fails every time. I won't know how many Directory entries or
> parameters I have ahead of time so that is not an option. I'm also
> trying to do this inside of puppet so I'm limited by what puppet
> provides me. Anyone have any ideas?

Thanks to Frederik, augeas in git now has a 'setm' command - it's not
exposed in the puppet provider yet. You should touch base with him to
see if you can work together on adding it in (should be a fairly simple
patch)

In augtool, you should now be able to say

        defvar httpd /files/etc/httpd/conf/httpd.conf
        setm $httpd/<Directory/Options param[last()+1] -ExecCGI

If you want to make sure you get all directory sections, not just the
ones at the top level, make that (note the double slash)

        setm $httpd//<Directory/Options param[last()+1] -ExecCGI
        
And to only modify Options lines that do not have -ExecCGI yet:

        setm $httpd//<Directory[count(Options/param[. = '-ExecCGI']) = 0]/Options param[last()+1] -ExecCGI
        
David






More information about the augeas-devel mailing list