Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added sanitization of the default zone_id return val

  • Loading branch information...
commit d2f910adecfa6418d5e36846b880c60ad1fc52e6 1 parent 2a5df0b
Jay Deiman authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 boto/route53/connection.py
View
13 boto/route53/connection.py
@@ -121,6 +121,7 @@ def get_hosted_zone(self, hosted_zone_id):
:param hosted_zone_id: The unique identifier for the Hosted Zone
"""
+ hosted_zone_id = self._sanitize_zone_id(hosted_zone_id)
uri = '/%s/hostedzone/%s' % (self.Version, hosted_zone_id)
response = self.make_request('GET', uri)
body = response.read()
@@ -204,6 +205,7 @@ def create_hosted_zone(self, domain_name, caller_ref=None, comment=''):
body)
def delete_hosted_zone(self, hosted_zone_id):
+ hosted_zone_id = self._sanitize_zone_id(hosted_zone_id)
uri = '/%s/hostedzone/%s' % (self.Version, hosted_zone_id)
response = self.make_request('DELETE', uri)
body = response.read()
@@ -271,6 +273,7 @@ def get_all_rrsets(self, hosted_zone_id, type=None,
:param maxitems: The maximum number of records
"""
+ hosted_zone_id = self._sanitize_zone_id(hosted_zone_id)
from boto.route53.record import ResourceRecordSets
params = {'type': type, 'name': name,
'Identifier': identifier, 'maxitems': maxitems}
@@ -302,6 +305,7 @@ def change_rrsets(self, hosted_zone_id, xml_body):
XML schema defined by the Route53 service.
"""
+ hosted_zone_id = self._sanitize_zone_id(hosted_zone_id)
uri = '/%s/hostedzone/%s/rrset' % (self.Version, hosted_zone_id)
response = self.make_request('POST', uri,
{'Content-Type': 'text/xml'},
@@ -341,3 +345,12 @@ def get_change(self, change_id):
h = boto.jsonresponse.XmlHandler(e, None)
h.parse(body)
return e
+
+ def _sanitize_zone_id(self , zone_id):
+ """
+ The "Id" value of a hosted zone is actually returned as
+ "/hostedzone/<Id>". This breaks any calls that use that zone id
+ if it is not removed outside of this library. This method
+ simply removes that.
+ """
+ return zone_id.replace('/hostedzone/' , '')
Please sign in to comment.
Something went wrong with that request. Please try again.