Bug #1334
Oneacct crashes
Status: | Closed | Start date: | 07/04/2012 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | - | |||
Target version: | Release 3.6 | |||
Resolution: | fixed | Pull request: | ||
Affected Versions: | OpenNebula 3.6 |
Description
Hi,
Me again :p
oneadmin@sd-xxxx:~$ oneacct
/home/oneadmin/bin/oneacct:140:in `block in list_users': undefined method `uniq' for nil:NilClass (NoMethodError)
from /home/oneadmin/bin/oneacct:135:in `each'
from /home/oneadmin/bin/oneacct:135:in `list_users'
from /home/oneadmin/bin/oneacct:371:in `<main>'
oneadmin@sd-xx:~$ oneacct -x
"Normal XML output"
Thanks again for you great work and responsiveness :)
Associated revisions
Bug #1334: Add sanity checks to oneacct
Bug #1334: Add sanity checks to oneacct
(cherry picked from commit 7f4db04a34f8a3af916e4e09f5e78b3e87de7e8d)
Bug #1334: Fix oneacct retrieve_elements params
Bug #1334: Fix oneacct retrieve_elements params
(cherry picked from commit 9450987588093dc1a850bc661b75468f56f18aac)
History
#1 Updated by Carlos Martín about 9 years ago
Hi,
Can you paste the XML output? what OpenNebula version are you using, 3.5.80, or a more recent one from git?
Thanks for the feedback!
#2 Updated by Carlos Martín about 9 years ago
I haven't been able to reproduce the bug, and in fact the only thing that could trigger it is a bad formatted xml returned by the core. So, I'm still interested in that output :)
Just in case, I have added some sanity checks to the code.
thanks
#3 Updated by jordan pittier about 9 years ago
I am using the git version (pulled yesterday).
<HISTORY_RECORDS><HISTORY><OID>0</OID><SEQ>0</SEQ><HOSTNAME>127.0.0.1</HOSTNAME><HID>0</HID><STIME>1341438958</STIME><ETIME>1341439724</ETIME><VMMMAD>vmm_kvm</VMMMAD><VNMMAD>dummy</VNMMAD><TMMAD>shared</TMMAD><DS_ID>0</DS_ID><PSTIME>1341438958</PSTIME><PETIME>1341438958</PETIME><RSTIME>1341438958</RSTIME><RETIME>1341439724</RETIME><ESTIME>0</ESTIME><EETIME>0</EETIME><REASON>3</REASON><VM><ID>0</ID><UID>0</UID><GID>0</GID><UNAME>oneadmin</UNAME><GNAME>oneadmin</GNAME><NAME>sqd</NAME><PERMISSIONS><OWNER_U>1</OWNER_U><OWNER_M>1</OWNER_M><OWNER_A>0</OWNER_A><GROUP_U>0</GROUP_U><GROUP_M>0</GROUP_M><GROUP_A>0</GROUP_A><OTHER_U>0</OTHER_U><OTHER_M>0</OTHER_M><OTHER_A>0</OTHER_A></PERMISSIONS><LAST_POLL>1341439560</LAST_POLL><STATE>3</STATE><LCM_STATE>15</LCM_STATE><RESCHED>0</RESCHED><STIME>1341438903</STIME><ETIME>0</ETIME><DEPLOY_ID>one-0</DEPLOY_ID><MEMORY>1048576</MEMORY><CPU>0</CPU><NET_TX>0</NET_TX><NET_RX>0</NET_RX><TEMPLATE><CPU><![CDATA1]></CPU><DISK><CLONE><![CDATA[YES]]></CLONE><DATASTORE><![CDATA[default]]></DATASTORE><DATASTORE_ID><![CDATA1]></DATASTORE_ID><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><DISK_ID><![CDATA0]></DISK_ID><IMAGE><![CDATA[Debian6amd64]]></IMAGE><IMAGE_ID><![CDATA1]></IMAGE_ID><READONLY><![CDATA[NO]]></READONLY><SAVE><![CDATA[NO]]></SAVE><SOURCE><![CDATA[/home/oneadmin/var/datastores/1/be0eb68cb9ab2567c65e1779ab1f59f2]]></SOURCE><TARGET><![CDATA[vda]]></TARGET><TM_MAD><![CDATA[shared]]></TM_MAD><TYPE><![CDATA[FILE]]></TYPE></DISK><INSTANCE_TYPE><![CDATA[small]]></INSTANCE_TYPE><MEMORY><![CDATA1024]></MEMORY><NAME><![CDATA[sqd]]></NAME><VMID><![CDATA0]></VMID></TEMPLATE><HISTORY_RECORDS/></VM></HISTORY></HISTORY_RECORDS>
#4 Updated by Carlos Martín about 9 years ago
Hi,
With that XML string I still can't trigger your error. The xpath expression that is returning nil in your case, "HISTORY/VM[UID=0]/UNAME", is correct...
Maybe something related to the xpath engine is not working as it should. Can you please tell us the versions of ruby and the nokogiri gem (if installed)?
#5 Updated by jordan pittier about 9 years ago
I am using ruby 1.9.1. At first nokogiri gem was not installed. Then I installed nokogiri et now the "stack trace" looks like :
/var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node.rb:159:in `evaluate': Invalid expression: ["HISTORY/VM[UID=0]/UNAME"] (Nokogiri::XML::XPath::SyntaxError)
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node.rb:159:in `block in xpath'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node.rb:150:in `map'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node.rb:150:in `xpath'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node_set.rb:135:in `block in xpath'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node_set.rb:239:in `block in each'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node_set.rb:238:in `upto'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node_set.rb:238:in `each'
from /var/lib/gems/1.9.1/gems/nokogiri-1.5.5/lib/nokogiri/xml/node_set.rb:134:in `xpath'
from /home/oneadmin/lib/ruby/OpenNebula/XMLUtils.rb:157:in `retrieve_elements'
from /home/oneadmin/bin/oneacct:140:in `block in list_users'
from /home/oneadmin/bin/oneacct:135:in `each'
from /home/oneadmin/bin/oneacct:135:in `list_users'
from /home/oneadmin/bin/oneacct:371:in `<main>'
Hope that helps :)
#6 Updated by Carlos Martín about 9 years ago
- Status changed from New to Closed
- Target version set to Release 3.6
- Resolution set to fixed
So it turns out that instead of a string we had an array of one string... which is fine for most ruby versions, except for 1.9.1.
It is fixed now, thanks again for testing!