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

Brandon Whalen bwhalen at gmail.com
Thu Jun 17 14:52:30 UTC 2010


On Thu, Jun 17, 2010 at 10:07 AM, David Lutterkort <lutter at redhat.com>wrote:

> 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
>
>
>
> This does look like it should fit exactly what I need and I can't wait to
test it out. Unfortunately I really do need the puppet support I don't want
to distribute my own puppet and augeas RPM's so I'll have to wait until
Puppet is updated and EPEL has pulled everything in. But I can write out the
basic puppet for my modules and just not have the directory edits called
until they're supported. Thanks to both you and Frederik for helping with
this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20100617/f9bc5980/attachment.htm>


More information about the augeas-devel mailing list