Fix a bug with parsing custom types - make sure we "status" attribute is alaways available on the custom response type objects.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/53afe112 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/53afe112 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/53afe112 Branch: refs/heads/trunk Commit: 53afe1125e7334f3525758a76383a25b4bac8f76 Parents: 669364e Author: Tomaz Muraus <[email protected]> Authored: Sun Apr 5 12:59:52 2015 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sun Apr 5 12:59:52 2015 +0200 ---------------------------------------------------------------------- libcloud/compute/drivers/azure.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/53afe112/libcloud/compute/drivers/azure.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/azure.py b/libcloud/compute/drivers/azure.py index 2e31c5a..f0b6552 100644 --- a/libcloud/compute/drivers/azure.py +++ b/libcloud/compute/drivers/azure.py @@ -1365,20 +1365,25 @@ class AzureNodeDriver(NodeDriver): """ return self._parse_response_body_from_xml_text( - response.body, - return_type + response=response, + return_type=return_type ) - def _parse_response_body_from_xml_text(self, respbody, return_type): + def _parse_response_body_from_xml_text(self, response, return_type): """ parse the xml and fill all the data into a class of return_type """ + respbody = response.body doc = minidom.parseString(respbody) return_obj = return_type() for node in self._get_child_nodes(doc, return_type.__name__): self._fill_data_to_return_object(node, return_obj) + # Note: We always explicitly assign status code to the custom return + # type object + return_obj.status = response.status + return return_obj def _get_child_nodes(self, node, tag_name):
