Author: tomaz
Date: Sun Oct  9 10:46:04 2011
New Revision: 1180581

URL: http://svn.apache.org/viewvc?rev=1180581&view=rev
Log:
Add ex_force_slave_axfr method to Zerigo DNS driver and update a list of status 
code which indicate a success.

Modified:
    libcloud/trunk/libcloud/dns/drivers/zerigo.py

Modified: libcloud/trunk/libcloud/dns/drivers/zerigo.py
URL: 
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/dns/drivers/zerigo.py?rev=1180581&r1=1180580&r2=1180581&view=diff
==============================================================================
--- libcloud/trunk/libcloud/dns/drivers/zerigo.py (original)
+++ libcloud/trunk/libcloud/dns/drivers/zerigo.py Sun Oct  9 10:46:04 2011
@@ -83,6 +83,9 @@ class ZerigoDNSResponse(Response):
             raise MalformedResponseError('Failed to parse XML', body=self.body)
         return body
 
+    def success(self):
+        return self.status in [httplib.OK, httplib.CREATED, httplib.ACCEPTED]
+
     def parse_error(self):
         status = int(self.status)
 
@@ -270,6 +273,16 @@ class ZerigoDNSDriver(DNSDriver):
         zone = self._to_zone(elem=data)
         return zone
 
+    def ex_force_slave_axfr(self, zone):
+        """
+        Force a zone transfer.
+        """
+        path = API_ROOT + 'zones/%s/force_slave_axfr.xml' % (zone.id)
+        self.connection.set_context({'resource': 'zone', 'id': zone.id})
+        response = self.connection.request(path, method='POST')
+        assert response.status == httplib.ACCEPTED
+        return zone
+
     def _to_zone_elem(self, domain=None, type=None, ttl=None, extra=None):
         zone_elem = ET.Element('zone', {})
 


Reply via email to