HomeClusterLabs Projects

Fix: libcib: Don't match element based on XPath matching an attribute

Description

Fix: libcib: Don't match element based on XPath matching an attribute

A concrete example is clearer. Suppose the CIB contains the following
constraint:

<rsc_location id="cli-prefer-dummy" rsc="dummy" role="Promoted"

node="laptop" score="INFINITY"/>

Then a cibadmin --query for the score attribute outputs the entire
rsc_location element:

$ cibadmin --query --xpath '//@score'
<rsc_location id="loc_cons" rsc="dummy" node="laptop" score="INFINITY"/>

Similarly but worse, a cibadmin --delete command for the score attribute
deletes the entire element.

$ cibadmin --delete --xpath '@score'
$ cibadmin --query --xpath '
@score'
Call failed: No such device or address

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Wed, Mar 12, 11:38 PM
Parents
rP89a44762a782: API: libcrmcommon: Deprecate getXpathResult()
Branches
Unknown
Tags
Unknown