Fix merge conflicts and add EC2 Instance delete. Closes #576.

This commit is contained in:
Steve Pulec 2016-04-28 09:21:54 -04:00
commit a600deb96a
12 changed files with 461 additions and 50 deletions

View file

@ -85,6 +85,27 @@ class RecordSet(object):
record_set = hosted_zone.add_rrset(properties)
return record_set
@classmethod
def update_from_cloudformation_json(cls, original_resource, new_resource_name, cloudformation_json, region_name):
cls.delete_from_cloudformation_json(original_resource.name, cloudformation_json, region_name)
return cls.create_from_cloudformation_json(new_resource_name, cloudformation_json, region_name)
@classmethod
def delete_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
# this will break if you changed the zone the record is in, unfortunately
properties = cloudformation_json['Properties']
zone_name = properties.get("HostedZoneName")
if zone_name:
hosted_zone = route53_backend.get_hosted_zone_by_name(zone_name)
else:
hosted_zone = route53_backend.get_hosted_zone(properties["HostedZoneId"])
try:
hosted_zone.delete_rrset_by_name(resource_name)
except KeyError:
pass
def to_xml(self):
template = Template("""<ResourceRecordSet>
<Name>{{ record_set.name }}</Name>