[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] Please confirm: Augeas cannot use number labels in node tests

Hi Xavier,

Augeas XPath doesn't like digits are label values because it recognizes them as ints. The trick is to use `./` in front:

     match /*[./1 = "second"]

will work


On Mon, Jan 11, 2016 at 11:42 AM, Mol, Xavier (SCC) <xavier mol kit edu> wrote:
Hello Augeas experts,

can someone please confirm to me, that Augeas is unable to relate to numbered nodes in nodes tests with their label?

augtool> set /a/1 "first"
augtool> set /b/1 "second"
augtool> match /*[1 = "second"]
error: Invalid path _expression_
error: type error
/*[1 = "second"]|=|

There are alternative expressions one can use to pick the right node - e.g.

augtool> match /*[*[1] = "second"]
/b = (none)
augtool> match /*[*[label() = "1"][. = "second"]]
/b = (none)

But still I'm wondering whether this is intentional.


PS: This one obviously fails, because the string "1" will never equal "second"...

augtool> match /*["1" = "second"]
  (no matches)

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 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."

augeas-devel mailing list
augeas-devel redhat com

Raphaël Pinson
Infrastructure Developer & Training Leader
+33 458 482 013

Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]