[augeas-devel] path expression question

Patrick Spinler spinler.patrick at mayo.edu
Mon Sep 30 19:54:58 UTC 2013


Okay, so I have a structure like this:

augtool> ls "/files/etc/sysconfig/iptables/table/"
chain[1]/ = INPUT
chain[2]/ = FORWARD
chain[3]/ = OUTPUT
chain[4]/ = Mayo-Firewall-INPUT
append[1]/ = INPUT
append[2]/ = INPUT
append[3]/ = INPUT
append[4]/ = INPUT
append[5]/ = INPUT
append[6]/ = INPUT
append[7]/ = FORWARD
append[8]/ = Mayo-Firewall-INPUT
append[9]/ = Mayo-Firewall-INPUT
append[10]/ = Mayo-Firewall-INPUT
(...snip...)
append[27]/ = Mayo-Firewall-INPUT
append[28]/ = Mayo-Firewall-INPUT
append[29]/ = Mayo-Firewall-INPUT

I'd like to insert a new node immediately before the first

  append[. = 'Mayo-Firewall-INPUT']

node, that is, in this case, before append[8].  However, that position
in the tree, [8], is obviously not constant.

How might I do this?

I've tried expressions like this:

augtool> insert append before
"/files/etc/sysconfig/iptables/table/append[. = 'Mayo-Firewall-INPUT']"
error: Too many matches for path expression

and expressions involving [position(...)], like this

augtool> insert append before
"/files/etc/sysconfig/iptables/table/append[position(. =
'Mayo-Firewall-INPUT')]"
error: Invalid path expression


which obviously both fail.  Thoughts?

Thanks,
-- Pat




More information about the augeas-devel mailing list