[augeas-devel] SET fails with "too many matches" while MATCH finds zero

Mol, Xavier (SCC) xavier.mol at kit.edu
Thu Jan 7 14:26:48 UTC 2016


Hi all,

I think I got a lead on my problem and it will be difficult to explain... :-) This is how one can reproduce the same error without my custom lens:

augtool> set /tmp[1]/a "spam"
augtool> set /tmp[2]/b "eggs"
augtool> set /tmp[3]/c "beef"
augtool> set /tmp/a[. = "spam"] "pork"
augtool> set /tmp/d[. = "beans"] "beans"
error: Too many matches for path expression

Now the error message does make sense. Since nodes with label "d" can exist for every "tmp" branch individually, Augeas doesn't know how to select the right one to create "d" for. So what I actually should state is the following:

augtool> set /tmp[d = "beans"]/d "beans"

If Agueas doesn't find any "tmp" node with a (direct) child "d" and value "beans", it should first create a new "tmp" node and then subsequently a child node "d" with value "beans" for that new node.

The devil was hidden in the detail here, sorry for the noise. But someone in the future might still trip over a similar situation and profit from this mail.

Ciao,
Xavier.


> -----Original Message-----
> From: augeas-devel-bounces at redhat.com [mailto:augeas-devel-bounces at redhat.com] On Behalf Of Mol, Xavier (SCC)
> Sent: Tuesday, January 05, 2016 11:57 AM
> To: augeas-devel at redhat.com
> Subject: [augeas-devel] SET fails with "too many matches" while MATCH finds zero
> 
> Hello Augeas experts,
> 
> attached you can find one of my custom lenses, a test module for it (both pass augparse successfully) as well as a real world example file I
> want to use the lens on. The problem here is, that I want to create new nodes with SET, if matching for their value returns no result, and
> that fails in _some_ situations.
> 
> * set a[. = "eggs"] "eggs"
> 
> should create a new node with label "a" and value "eggs", if it doesn't exist already (otherwise nothing happens).
> 
> * set a[. = "eggs"] "spam"
> 
> should create a new node with label "a" and value "spam", unless there is already a node with label "a" and value "eggs", in that case, the
> value is changed to "spam".
> 
> 
> Hopefully, these two use cases are correct and reflect the intentions with Augeas' code base. Now onto my concrete issues...
> 
> augtool> match /augeas/version
> /augeas/version = 1.4.0
> augtool> defvar poolmanager /files/var/lib/dcache/config/poolmanager.conf
> augtool> match $poolmanager/psu/create/pool
> /files/var/lib/dcache/config/poolmanager.conf/psu[18]/create/pool = f01-151-104-e_1sT_shared
> /files/var/lib/dcache/config/poolmanager.conf/psu[19]/create/pool = f01-151-104-e_2wT_shared
> /files/var/lib/dcache/config/poolmanager.conf/psu[20]/create/pool = f01-151-104-e_3rT_shared
> /files/var/lib/dcache/config/poolmanager.conf/psu[21]/create/pool = f01-151-104-e_4D_shared
> augtool> match $poolmanager/psu/create/pool[. = "new_pool"]
>   (no matches)
> augtool> set $poolmanager/psu/create/pool[. = "new_pool"] "new_pool"
> error: Too many matches for path expression
> augtool> defnode this $poolmanager/psu/create/pool[. = "new_pool"]
> error: Too many matches for path expression
> 
> 
> I suppose I ran into another situation where hidden nodes are matched by augtool, which are not printed by MATCH? There are quite a
> number of empty lines/nodes and comments as well as similar "create" nodes, all of which have the very same problem:
> 
> augtool> ls /files/var/lib/dcache/config/poolmanager.conf/psu/create
> unit/ = 0.0.0.0/0.0.0.0
> unit/ = */*
> unit/ = *@*
> unit/ = ch_ops:OPS at osm
> unit/ = ch_ops:OPS-disk-only at osm
> unit/ = ch_dteam:DTEAM at osm
> unit/ = ch_dteam:DTEAM-disk-only at osm
> ugroup = world-net
> ugroup = shared-disk-only-store
> ugroup = shared-tape-store
> pool = f01-151-104-e_1sT_shared
> pool = f01-151-104-e_2wT_shared
> pool = f01-151-104-e_3rT_shared
> pool = f01-151-104-e_4D_shared
> pgroup = all-pools
> pgroup = all-tape-pools
> pgroup = p2pClient-pools
> pgroup = shared-disk-only-pools
> pgroup = shared-write-tape-pools
> pgroup = shared-read-tape-pools
> pgroup = shared-stage-pools
> pgroup = shared-prime-stage-pools
> pgroup = shared-fallback-stage-pools
> link/ = shared-disk-only-link
> link/ = shared-write-tape-link
> link/ = shared-read-tape-link
> link/ = shared-prime-stage-link
> link/ = shared-fallback-stage-link
> linkGroup = shared-tape-linkGroup
> linkGroup = shared-disk-only-linkGroup
> 
> 
> Did I make a mistake in my lens definition? Or can you possibly confirm that this is a bug? Can I avoid this error by adapting the lens in
> some way?
> 
> Ciao,
> Xavier.
> 
> ****
> Karlsruher Institute of Technology (KIT)
> Steinbuch Centre for Computing (SCC)
> 
> B. Sc. Xavier Mol
> GridKa Storage Administrator and Support Manager
> 
> Hermann-von-Helmholtz-Platz 1
> Geb. 449
> 76344 Eggenstein-Leopoldshafen
> Phone: +49 721 608 23041
> Email: xavier.mol at kit.edu
> www.kit.edu
> KIT - University of the State of Baden-Württemberg and National Large-scale Research Center of the Helmholtz Association
> "Since 2010, the KIT has been certified as a family-friendly university."
> ****

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6401 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20160107/f26b3c99/attachment.p7s>


More information about the augeas-devel mailing list