diff --git a/moto/route53/models.py b/moto/route53/models.py index 7838b47d8..047bee1da 100644 --- a/moto/route53/models.py +++ b/moto/route53/models.py @@ -113,7 +113,8 @@ class FakeZone(object): def __init__(self, name, id_, comment=None): self.name = name self.id = id_ - self.comment = comment + if comment is not None: + self.comment = comment self.private_zone = False self.rrsets = [] diff --git a/moto/route53/responses.py b/moto/route53/responses.py index 627e83f5a..2639caa0c 100644 --- a/moto/route53/responses.py +++ b/moto/route53/responses.py @@ -9,7 +9,10 @@ def list_or_create_hostzone_response(request, full_url, headers): if request.method == "POST": elements = xmltodict.parse(request.body) - comment = elements["CreateHostedZoneRequest"]["HostedZoneConfig"]["Comment"] + if "HostedZoneConfig" in elements["CreateHostedZoneRequest"]: + comment = elements["CreateHostedZoneRequest"]["HostedZoneConfig"]["Comment"] + else: + comment = None new_zone = route53_backend.create_hosted_zone(elements["CreateHostedZoneRequest"]["Name"], comment=comment) template = Template(CREATE_HOSTED_ZONE_RESPONSE) return 201, headers, template.render(zone=new_zone) @@ -138,7 +141,9 @@ GET_HOSTED_ZONE_RESPONSE = """