Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2126 from jimbrowne/route53-alias-healthcheck-fix

Fix Route53 aliases, which were broken by the addition of health checks. Fixes #2162.
  • Loading branch information...
commit 141077f0c4d2b8047f5a4fed80e572f621d4c52d 2 parents d75fdfa + e8e1de1
@danielgtaylor danielgtaylor authored
View
6 boto/route53/record.py
@@ -254,10 +254,12 @@ def add_value(self, value):
"""Add a resource record value"""
self.resource_records.append(value)
- def set_alias(self, alias_hosted_zone_id, alias_dns_name):
+ def set_alias(self, alias_hosted_zone_id, alias_dns_name,
+ alias_evaluate_target_health=False):
"""Make this an alias resource record set"""
self.alias_hosted_zone_id = alias_hosted_zone_id
self.alias_dns_name = alias_dns_name
+ self.alias_evaluate_target_health = alias_evaluate_target_health
def to_xml(self):
"""Spit this resource record set out as XML"""
@@ -310,6 +312,8 @@ def to_print(self):
if self.alias_hosted_zone_id is not None and self.alias_dns_name is not None:
# Show alias
rr = 'ALIAS ' + self.alias_hosted_zone_id + ' ' + self.alias_dns_name
+ if self.alias_evaluate_target_health is not None:
+ rr += ' (EvalTarget %s)' % self.alias_evaluate_target_health
else:
# Show resource record(s)
rr = ",".join(self.resource_records)
View
33 tests/integration/route53/test_alias_resourcerecordsets.py
@@ -1,4 +1,5 @@
# Copyright (c) 2014 Netflix, Inc. Stefan Praszalowicz
+# Copyright (c) 2014 42Lines, Inc. Jim Browne
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
@@ -79,5 +80,37 @@ def test_add_alias(self):
rrs.commit()
+ def test_set_alias(self):
+ base_record = dict(name="alias.%s." % self.base_domain,
+ type="A",
+ identifier="boto:TestRoute53AliasResourceRecordSets")
+
+ rrs = ResourceRecordSets(self.conn, self.zone.id)
+ new = rrs.add_change(action="UPSERT", **base_record)
+ new.set_alias(self.zone.id, "target.%s" % self.base_domain, False)
+ rrs.commit()
+
+ rrs = ResourceRecordSets(self.conn, self.zone.id)
+ delete = rrs.add_change(action="DELETE", **base_record)
+ delete.set_alias(self.zone.id, "target.%s" % self.base_domain, False)
+ rrs.commit()
+
+
+ def test_set_alias_backwards_compatability(self):
+ base_record = dict(name="alias.%s." % self.base_domain,
+ type="A",
+ identifier="boto:TestRoute53AliasResourceRecordSets")
+
+ rrs = ResourceRecordSets(self.conn, self.zone.id)
+ new = rrs.add_change(action="UPSERT", **base_record)
+ new.set_alias(self.zone.id, "target.%s" % self.base_domain)
+ rrs.commit()
+
+ rrs = ResourceRecordSets(self.conn, self.zone.id)
+ delete = rrs.add_change(action="DELETE", **base_record)
+ delete.set_alias(self.zone.id, "target.%s" % self.base_domain)
+ rrs.commit()
+
+
if __name__ == '__main__':
unittest.main()

0 comments on commit 141077f

Please sign in to comment.
Something went wrong with that request. Please try again.