On Wed, Jun 03, 2009 at 10:45:41PM +0200, Andrew Beekhof wrote:
> fixed:
>    http://hg.clusterlabs.org/pacemaker/stable-1.0/rev/cf478ed1269f

thanks.
though that simply returns the parent XML_ELEMENT_NODE,
which makes both
'//primiti...@type="IPaddr2" and instance_attributes/nvpa...@name = "ip" and 
@value="10.0.0.1"]]' and
'//primiti...@type="IPaddr2" and instance_attributes/nvpa...@name = "ip" and 
@value="10.0.0.1"]]/@id'
return the same, namely the full primitive xml:
      <primitive class="ocf" id="ip_try3" provider="heartbeat" type="IPaddr2">
        <instance_attributes id="ip_try3-instance_attributes">
          <nvpair id="ip_try3-instance_attributes-ip" name="ip" 
value="10.0.0.1"/>
        </instance_attributes>
      </primitive>

where I would have liked the ..../@id to only spit out
        ip_try3

current workaround is obviously
 | sed -ne '1 { s/^<.* id="\([^"]*\)".*>$/\1/p; };q'

but "it would be nice..."
hm. maybe I can hack something there myself.

> > cat > tmp.xml <<___
> > <cib>
> >  <configuration>
> >    <resources>
> >      <primitive class="ocf" id="ip_try3" provider="heartbeat" 
> > type="IPaddr2">
> >        <instance_attributes id="ip_try3-instance_attributes">
> >          <nvpair id="ip_try3-instance_attributes-ip" name="ip" 
> > value="10.0.0.1"/>
> >        </instance_attributes>
> >      </primitive>
> >    </resources>
> >  </configuration>
> > </cib>
> > ___
> >
> >
> > xmllint --shell tmp.xml <<<'ls //@id'
> > / > ls //@id
> > tan        7 ip_try3
> > t--       27 ip_try3-instance_attributes
> > t--       30 ip_try3-instance_attributes-ip
> > / >
> >
> > xmllint --shell tmp.xml <<<'ls //primiti...@type="IPaddr2" and 
> > instance_attributes/nvpa...@name = "ip" and @value="10.0.0.1"]]/@id'
> > / > ls //primiti...@type="IPaddr2" and instance_attributes/nvpa...@name = 
> > "ip" and @value="10.0.0.1"]]/@id
> > tan        7 ip_try3
> > / >

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.

_______________________________________________
Pacemaker mailing list
Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Reply via email to