You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2011/11/12 02:24:34 UTC
svn commit: r1201141 - in /libcloud/trunk: CHANGES
libcloud/dns/drivers/rackspace.py test/dns/test_rackspace.py
Author: tomaz
Date: Sat Nov 12 01:24:34 2011
New Revision: 1201141
URL: http://svn.apache.org/viewvc?rev=1201141&view=rev
Log:
Fix a bug in Rackspace Cloud DNS driver and make sure to throw an
exception if an unexpected status code is returned. Reported by
"jeblair"
Modified:
libcloud/trunk/CHANGES
libcloud/trunk/libcloud/dns/drivers/rackspace.py
libcloud/trunk/test/dns/test_rackspace.py
Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1201141&r1=1201140&r2=1201141&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat Nov 12 01:24:34 2011
@@ -37,9 +37,15 @@ Changes with Apache Libcloud in developm
[Tomaz Muraus]
*) DNS:
+
- Increase the default poll interval in the Rackspace driver to 2.5
- seconds
- [Tomaz Muraus]
+ seconds.
+ [Tomaz Muraus]
+
+ - Fix a bug in Rackspace Cloud DNS driver and make sure to throw an
+ exception if an unexpected status code is returned. Reported by
+ jeblair.
+ [Tomaz Muraus]
Changes with Apache Libcloud 0.6.1:
Modified: libcloud/trunk/libcloud/dns/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/dns/drivers/rackspace.py?rev=1201141&r1=1201140&r2=1201141&view=diff
==============================================================================
--- libcloud/trunk/libcloud/dns/drivers/rackspace.py (original)
+++ libcloud/trunk/libcloud/dns/drivers/rackspace.py Sat Nov 12 01:24:34 2011
@@ -63,15 +63,17 @@ class RackspaceDNSResponse(OpenStack_1_1
elif context['resource'] == 'record':
raise RecordDoesNotExistError(value='', driver=self,
record_id=context['id'])
+ if body:
+ if 'code' and 'message' in body:
+ err = '%s - %s (%s)' % (body['code'], body['message'],
+ body['details'])
+ return err
+ elif 'validationErrors' in body:
+ errors = [m for m in body['validationErrors']['messages']]
+ err = 'Validation errors: %s' % ', '.join(errors)
+ return err
- if 'code' and 'message' in body:
- err = '%s - %s (%s)' % (body['code'], body['message'],
- body['details'])
- elif 'validationErrors' in body:
- errors = [m for m in body['validationErrors']['messages']]
- err = 'Validation errors: %s' % ', '.join(errors)
-
- return err
+ raise LibcloudError('Unexpected status code: %s' % (status))
class RackspaceDNSConnection(OpenStack_1_1_Connection, PollingConnection):
Modified: libcloud/trunk/test/dns/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/dns/test_rackspace.py?rev=1201141&r1=1201140&r2=1201141&view=diff
==============================================================================
--- libcloud/trunk/test/dns/test_rackspace.py (original)
+++ libcloud/trunk/test/dns/test_rackspace.py Sat Nov 12 01:24:34 2011
@@ -48,6 +48,16 @@ class RackspaceUSTests(unittest.TestCase
self.assertEqual(zones[0].domain, 'foo4.bar.com')
self.assertEqual(zones[0].extra['comment'], 'wazaaa')
+ def test_list_zones_http_413(self):
+ RackspaceMockHttp.type = '413'
+
+ try:
+ self.driver.list_zones()
+ except LibcloudError:
+ pass
+ else:
+ self.fail('Exception was not thrown')
+
def test_list_zones_no_results(self):
RackspaceMockHttp.type = 'NO_RESULTS'
zones = self.driver.list_zones()
@@ -269,6 +279,11 @@ class RackspaceMockHttp(MockHttp):
return (httplib.OK, body, self.base_headers,
httplib.responses[httplib.OK])
+ def _v1_0_11111_domains_413(self, method, url, body, headers):
+ body = ''
+ return (httplib.REQUEST_ENTITY_TOO_LARGE, body, self.base_headers,
+ httplib.responses[httplib.REQUEST_ENTITY_TOO_LARGE])
+
def _v1_0_11111_domains_NO_RESULTS(self, method, url, body, headers):
body = self.fixtures.load('list_zones_no_results.json')
return (httplib.OK, body, self.base_headers,