From 34744b7b347e82a56f3f618d6a3f2603af438ba8 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Wed, 3 Apr 2019 13:10:19 -0700 Subject: [PATCH] Normalize ip addresses for comparing health checks since Route53 does --- octodns/provider/route53.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/octodns/provider/route53.py b/octodns/provider/route53.py index 6764daf..c61e0cd 100644 --- a/octodns/provider/route53.py +++ b/octodns/provider/route53.py @@ -934,11 +934,23 @@ class Route53Provider(BaseProvider): def _health_check_equivilent(self, host, path, protocol, port, measure_latency, health_check, value=None): config = health_check['HealthCheckConfig'] + + # So interestingly Route53 normalizes IPAddress which will cause us to + # fail to find see things as equivalent. To work around this we'll + # ip_address's returned object for equivalence + # E.g 2001:4860:4860::8842 -> 2001:4860:4860:0:0:0:0:8842 + if value: + value = ip_address(unicode(value)) + config_ip_address = ip_address(unicode(config['IPAddress'])) + else: + # No value so give this a None to match value's + config_ip_address = None + return host == config['FullyQualifiedDomainName'] and \ path == config['ResourcePath'] and protocol == config['Type'] \ and port == config['Port'] and \ measure_latency == config['MeasureLatency'] and \ - (value is None or value == config['IPAddress']) + value == config_ip_address def get_health_check_id(self, record, value, create): # fqdn & the first value are special, we use them to match up health