Updated R53 ID's to match what AWS do now

This commit is contained in:
Terry Cain 2017-09-22 23:50:01 +01:00
parent d692219927
commit 17d9701d19
No known key found for this signature in database
GPG Key ID: 14D90844E4E9B9F3

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