Comment's params is optional in create_hosted_zones. It is fix to support and templates adapted to it.

This commit is contained in:
beeva-antonioirizar 2016-02-17 15:32:38 +01:00
parent 1ac40cbaf6
commit a621c83bf7
2 changed files with 15 additions and 5 deletions

View File

@ -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 = []

View File

@ -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 = """<GetHostedZoneResponse xmlns="https://route53.amaz
<Name>{{ zone.name }}</Name>
<ResourceRecordSetCount>{{ zone.rrsets|count }}</ResourceRecordSetCount>
<Config>
<Comment>{{ zone.comment }}</Comment>
{% if zone.comment %}
<Comment>{{ zone.comment }}</Comment>
{% endif %}
<PrivateZone>{{ zone.private_zone }}</PrivateZone>
</Config>
</HostedZone>
@ -155,7 +160,9 @@ CREATE_HOSTED_ZONE_RESPONSE = """<CreateHostedZoneResponse xmlns="https://route5
<Name>{{ zone.name }}</Name>
<ResourceRecordSetCount>0</ResourceRecordSetCount>
<Config>
<Comment>{{ zone.comment }}</Comment>
{% if zone.comment %}
<Comment>{{ zone.comment }}</Comment>
{% endif %}
<PrivateZone>{{ zone.private_zone }}</PrivateZone>
</Config>
</HostedZone>
@ -173,7 +180,9 @@ LIST_HOSTED_ZONES_RESPONSE = """<ListHostedZonesResponse xmlns="https://route53.
<Id>{{ zone.id }}</Id>
<Name>{{ zone.name }}</Name>
<Config>
<Comment>{{ zone.comment }}</Comment>
{% if zone.comment %}
<Comment>{{ zone.comment }}</Comment>
{% endif %}
<PrivateZone>{{ zone.private_zone }}</PrivateZone>
</Config>
<ResourceRecordSetCount>{{ zone.rrsets|count }}</ResourceRecordSetCount>