Repository: libcloud Updated Branches: refs/heads/trunk 907cdcee7 -> 68c73b5ca
Include a better message in the exception which is thrown when a request in the Rackspace driver ends up in an ERROR state. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/68c73b5c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/68c73b5c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/68c73b5c Branch: refs/heads/trunk Commit: 68c73b5ca61d8c8f5531b561a3ffd060da743187 Parents: 907cdce Author: Tomaz Muraus <[email protected]> Authored: Wed Jul 2 15:28:01 2014 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Wed Jul 2 15:28:01 2014 +0200 ---------------------------------------------------------------------- CHANGES.rst | 7 +++++++ libcloud/dns/drivers/rackspace.py | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/68c73b5c/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index bc28e97..0ffeb7c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -42,6 +42,13 @@ Compute (GITHUB-331) [David Gay] +DNS +~~~ + +- Include a better message in the exception which is thrown when a request + in the Rackspace driver ends up in an ``ERROR`` state. + [Tomaz Muraus] + Changes with Apache Libcloud 0.15.0 ----------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/68c73b5c/libcloud/dns/drivers/rackspace.py ---------------------------------------------------------------------- diff --git a/libcloud/dns/drivers/rackspace.py b/libcloud/dns/drivers/rackspace.py index 55f834f..d71f4c5 100644 --- a/libcloud/dns/drivers/rackspace.py +++ b/libcloud/dns/drivers/rackspace.py @@ -93,7 +93,15 @@ class RackspaceDNSConnection(OpenStack_1_1_Connection, PollingConnection): def has_completed(self, response): status = response.object['status'] if status == 'ERROR': - raise LibcloudError(response.object['error']['message'], + data = response.object['error'] + + if 'code' and 'message' in data: + message = '%s - %s (%s)' % (data['code'], data['message'], + data['details']) + else: + message = data['message'] + + raise LibcloudError(message, driver=self.driver) return status == 'COMPLETED' @@ -318,6 +326,7 @@ class RackspaceDNSDriver(DNSDriver, OpenStackDriverMixin): updated_record = get_new_obj(obj=record, klass=Record, attributes={'type': type, 'data': data, + 'driver': self, 'extra': merged}) return updated_record
