Merge pull request #1184 from terrycain/route53_id_fix

Updated R53 ID's to match what AWS do now
This commit is contained in:
Jack Danger 2017-09-25 14:00:10 -07:00 committed by GitHub
commit 23d4a672bb

View File

@ -2,11 +2,20 @@ from __future__ import unicode_literals
from collections import defaultdict from collections import defaultdict
import string
import random
import uuid import uuid
from jinja2 import Template from jinja2 import Template
from moto.core import BaseBackend, BaseModel from moto.core import BaseBackend, BaseModel
from moto.core.utils import get_random_hex
ROUTE53_ID_CHOICE = string.ascii_uppercase + string.digits
def create_route53_zone_id():
# New ID's look like this Z1RWWTK7Y8UDDQ
return ''.join([random.choice(ROUTE53_ID_CHOICE) for _ in range(0, 15)])
class HealthCheck(BaseModel): class HealthCheck(BaseModel):
@ -247,7 +256,7 @@ class Route53Backend(BaseBackend):
self.resource_tags = defaultdict(dict) self.resource_tags = defaultdict(dict)
def create_hosted_zone(self, name, private_zone, comment=None): def create_hosted_zone(self, name, private_zone, comment=None):
new_id = get_random_hex() new_id = create_route53_zone_id()
new_zone = FakeZone( new_zone = FakeZone(
name, new_id, private_zone=private_zone, comment=comment) name, new_id, private_zone=private_zone, comment=comment)
self.zones[new_id] = new_zone self.zones[new_id] = new_zone