[
https://issues.apache.org/jira/browse/LIBCLOUD-230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798884#comment-13798884
]
Tomaz Muraus commented on LIBCLOUD-230:
---------------------------------------
[~AnneTheAgile] Oops, it looks I originally forgot to follow up on this issue,
anyway...
Luckily, things like this don't happen too often (two supposedly compatible
providers returning different data for the same endpoint). In similar cases
though, we usually handle it in a sub-class (in this case it would mean
Rackspace driver).
As far as this specific issues goes, from the original issue description above,
it looks like both providers return the same response and it's actually a bug
in the OpenStack_1_0_NodeDriver._to_node_from_obj method.
The solutions seems to be fixing _to_node_from_obj method and making sure it
passes correct object to the "_to_node" method. And we also need test for this
functionality, since currently we seem to be lacking one (there is a test for
OpenStack_1_1_NodeDriver, but not for OpenStack_1_0_Nodedriver).
This issue also seems like a perfect one for a test-driven approach - write a
test first (it should fail) and then make a fix in the
OpenStack_1_0_NodeDriver._to_node_from_obj method (it should pass).
> xml parsing error in get node details function of open stack driver
> (rackspace)
> -------------------------------------------------------------------------------
>
> Key: LIBCLOUD-230
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-230
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Affects Versions: 0.10.1
> Reporter: Jayy Vis
> Priority: Minor
>
> Problem
> While trying retrieve a rackspace node, ex_get_node_details() function of
> openstack driver throws "IndexError: list index out of range"
> Investigation
> The xml response from rackspace has the root element as <server>..</server> .
> Confirmed the same with rackspace & openstack api documentation.
> But _to_node_from_obj() function tries to find the 'server' subelements out
> of the response xml and thus resulting in empty list.
> Stacktrace:
> node = driver.ex_get_node_details(node_id)
> File
> "/home/jay/workspace/dev/pickled/py_modules/libcloud/compute/drivers/openstack.py",
> line 233, in ex_get_node_details
> return self._to_node_from_obj(resp.object)
> File
> "/home/jay/workspace/dev/pickled/py_modules/libcloud/compute/drivers/openstack.py",
> line 598, in _to_node_from_obj
> self.XML_NAMESPACE)[0])
> IndexError: list index out of range
--
This message was sent by Atlassian JIRA
(v6.1#6144)