Support HostedZoneId in RecordSet templates
Signed-off-by: Jesse Szwedko <jesse.szwedko@getbraintree.com>
This commit is contained in:
parent
ad2dca607f
commit
2c72a86778
@ -77,8 +77,11 @@ class RecordSet(object):
|
|||||||
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
||||||
properties = cloudformation_json['Properties']
|
properties = cloudformation_json['Properties']
|
||||||
|
|
||||||
zone_name = properties["HostedZoneName"]
|
zone_name = properties.get("HostedZoneName")
|
||||||
hosted_zone = route53_backend.get_hosted_zone_by_name(zone_name)
|
if zone_name:
|
||||||
|
hosted_zone = route53_backend.get_hosted_zone_by_name(zone_name)
|
||||||
|
else:
|
||||||
|
hosted_zone = route53_backend.get_hosted_zone(properties["HostedZoneId"])
|
||||||
record_set = hosted_zone.add_rrset(properties)
|
record_set = hosted_zone.add_rrset(properties)
|
||||||
return record_set
|
return record_set
|
||||||
|
|
||||||
@ -112,6 +115,8 @@ class RecordSet(object):
|
|||||||
def delete(self, *args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
''' Not exposed as part of the Route 53 API - used for CloudFormation. args are ignored '''
|
''' Not exposed as part of the Route 53 API - used for CloudFormation. args are ignored '''
|
||||||
hosted_zone = route53_backend.get_hosted_zone_by_name(self.hosted_zone_name)
|
hosted_zone = route53_backend.get_hosted_zone_by_name(self.hosted_zone_name)
|
||||||
|
if not hosted_zone:
|
||||||
|
hosted_zone = route53_backend.get_hosted_zone(self.hosted_zone_id)
|
||||||
hosted_zone.delete_rrset_by_name(self.name)
|
hosted_zone.delete_rrset_by_name(self.name)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user