Skip to content

Commit

Permalink
Merge pull request #867 from 2rs2ts/flexible-route53-hostedzoneid-lookup
Browse files Browse the repository at this point in the history
Be flexible with Route53 Hosted Zone IDs with /hostedzone/ prefix
  • Loading branch information
spulec committed Mar 17, 2017
2 parents c207963 + f2b7ba0 commit a6e7623
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions moto/route53/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,15 @@ def get_all_hosted_zones(self):
return self.zones.values()

def get_hosted_zone(self, id_):
return self.zones.get(id_)
return self.zones.get(id_.replace("/hostedzone/", ""))

def get_hosted_zone_by_name(self, name):
for zone in self.get_all_hosted_zones():
if zone.name == name:
return zone

def delete_hosted_zone(self, id_):
zone = self.zones.get(id_)
if zone:
del self.zones[id_]
return zone
return self.zones.pop(id_.replace("/hostedzone/", ""), None)

def create_health_check(self, health_check_args):
health_check_id = str(uuid.uuid4())
Expand Down

0 comments on commit a6e7623

Please sign in to comment.