[augeas-devel] relative positioning?

Ian Mortimer i.mortimer at uq.edu.au
Mon Mar 3 00:10:38 UTC 2014


Hi

In httpd.conf, I'm trying to convert a block like this:

     Order allow,deny      ->     Order deny,allow
     Allow from all        ->     deny from all
                           ->     allow from 10.1.1.0/24

This is simple enough using fixed positions:

defvar c /files/etc/httpd/conf/httpd.conf
set $c/Directory[2]/directive[3]/arg "deny,allow"
set $c/Directory[2]/directive[4] "deny"
set $c/Directory[2]/directive[5] "allow"
set $c/Directory[2]/directive[5]/arg[1] "from"
set $c/Directory[2]/directive[5]/arg[2] "10.1.1.0/24"

But this will be wrong if another directive is inserted before these
so I need to define the positions relative to the first.  The first
is easy:

set "$c/Directory[2]/directive[.  = 'Order']/arg" deny,allow

Everything I've tried for the position after that either gets an
error or adds a new setting in the wrong place.

Is there any way to define a position relative to another?


Thanks
-- 
Ian




More information about the augeas-devel mailing list