libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1439254 - /libcloud/trunk/libcloud/dns/drivers/route53.py
Date Mon, 28 Jan 2013 05:09:36 GMT
Author: tomaz
Date: Mon Jan 28 05:09:35 2013
New Revision: 1439254

URL: http://svn.apache.org/viewvc?rev=1439254&view=rev
Log:
Include some fixes for the Route53 driver.

Contributed by John Carr, part of LIBCLOUD-285.

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

Modified: libcloud/trunk/libcloud/dns/drivers/route53.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/dns/drivers/route53.py?rev=1439254&r1=1439253&r2=1439254&view=diff
==============================================================================
--- libcloud/trunk/libcloud/dns/drivers/route53.py (original)
+++ libcloud/trunk/libcloud/dns/drivers/route53.py Mon Jan 28 05:09:35 2013
@@ -134,8 +134,16 @@ class Route53DNSDriver(DNSDriver):
     def get_record(self, zone_id, record_id):
         zone = self.get_zone(zone_id=zone_id)
         record_type, name = record_id.split(':', 1)
+        if name:
+            full_name = ".".join((name, zone.domain))
+        else:
+            full_name = zone.domain
         self.connection.set_context({'zone_id': zone_id})
-        params = urlencode({'name': name, 'type': record_type})
+        params = urlencode({
+            'name': full_name,
+            'type': record_type,
+            'maxitems': '1'
+        })
         uri = API_ROOT + 'hostedzone/' + zone_id + '/rrset?' + params
         data = self.connection.request(uri).object
 
@@ -232,7 +240,7 @@ class Route53DNSDriver(DNSDriver):
             rrs = ET.SubElement(change, 'ResourceRecordSet')
             ET.SubElement(rrs, 'Name').text = name + "." + zone.domain
             ET.SubElement(rrs, 'Type').text = self.RECORD_TYPE_MAP[type_]
-            ET.SubElement(rrs, 'TTL').text = extra.get('ttl', '0')
+            ET.SubElement(rrs, 'TTL').text = str(extra.get('ttl', '0'))
 
             rrecs = ET.SubElement(rrs, 'ResourceRecords')
             rrec = ET.SubElement(rrecs, 'ResourceRecord')



Mime
View raw message