Bug #4896

xpath.rb can't print XPath-specified attributes

Added by Roy Keene almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:11/04/2016
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Core & System
Target version:Release 5.4
Resolution:fixed Pull request:
Affected Versions:OpenNebula 4.12, OpenNebula 4.14, OpenNebula 5.0, OpenNebula 5.2

Description

Attempting to use "xpath.rb" to print attributes (as opposed to body text) fails.

Patch attached.

Example:

$ virsh --connect qemu:///system dumpxml one-0 2>/dev/null | /var/tmp/one/datastore/xpath.rb '/domain/devices/disk[1]/source/@protocol'                        
/var/tmp/one/datastore/xpath.rb:67:in `block in <main>': undefined method `text' for protocol='rbd':REXML::Attribute (NoMethodError)
        from /var/tmp/one/datastore/xpath.rb:60:in `each'
        from /var/tmp/one/datastore/xpath.rb:60:in `<main>'
$

Fixed:

$ virsh --connect qemu:///system dumpxml one-0 2>/dev/null | /var/tmp/one/datastore/xpath.rb '/domain/devices/disk[1]/source/@protocol' 
rbd
$

opennebula-5.2.0-xpathattrs.diff Magnifier (751 Bytes) Roy Keene, 11/04/2016 08:00 AM

Associated revisions

Revision f46d64f7
Added by Roy Keene almost 4 years ago

B #4896: xpath.rb can't print XPath-specified attributes

Signed-off-by: Ruben S. Montero <>

History

#1 Updated by Ruben S. Montero almost 4 years ago

  • Category set to Core & System
  • Status changed from Pending to Closed
  • Target version set to Release 5.4
  • Resolution set to fixed

Also available in: Atom PDF