|
|
@ -526,11 +526,12 @@ class Route53Provider(BaseProvider): |
|
|
# We've got a cached version use it |
|
|
# We've got a cached version use it |
|
|
return self._health_checks |
|
|
return self._health_checks |
|
|
|
|
|
|
|
|
def _health_check_equivilent(self, host, path, health_check, |
|
|
|
|
|
first_value=None): |
|
|
|
|
|
|
|
|
def _health_check_equivilent(self, host, path, protocol, port, |
|
|
|
|
|
health_check, first_value=None): |
|
|
config = health_check['HealthCheckConfig'] |
|
|
config = health_check['HealthCheckConfig'] |
|
|
return host == config['FullyQualifiedDomainName'] and \ |
|
|
return host == config['FullyQualifiedDomainName'] and \ |
|
|
path == config['ResourcePath'] and \ |
|
|
|
|
|
|
|
|
path == config['ResourcePath'] and protocol == config['Type'] \ |
|
|
|
|
|
and port == config['Port'] and \ |
|
|
(first_value is None or first_value == config['IPAddress']) |
|
|
(first_value is None or first_value == config['IPAddress']) |
|
|
|
|
|
|
|
|
def get_health_check_id(self, record, ident, geo, create): |
|
|
def get_health_check_id(self, record, ident, geo, create): |
|
|
@ -546,6 +547,8 @@ class Route53Provider(BaseProvider): |
|
|
|
|
|
|
|
|
healthcheck_host = record.healthcheck_host |
|
|
healthcheck_host = record.healthcheck_host |
|
|
healthcheck_path = record.healthcheck_path |
|
|
healthcheck_path = record.healthcheck_path |
|
|
|
|
|
healthcheck_protocol = record.healthcheck_protocol |
|
|
|
|
|
healthcheck_port = record.healthcheck_port |
|
|
|
|
|
|
|
|
# we're looking for a healthcheck with the current version & our record |
|
|
# we're looking for a healthcheck with the current version & our record |
|
|
# type, we'll ignore anything else |
|
|
# type, we'll ignore anything else |
|
|
@ -556,7 +559,9 @@ class Route53Provider(BaseProvider): |
|
|
# not a version & type match, ignore |
|
|
# not a version & type match, ignore |
|
|
continue |
|
|
continue |
|
|
if self._health_check_equivilent(healthcheck_host, |
|
|
if self._health_check_equivilent(healthcheck_host, |
|
|
healthcheck_path, health_check, |
|
|
|
|
|
|
|
|
healthcheck_path, |
|
|
|
|
|
healthcheck_protocol, |
|
|
|
|
|
healthcheck_port, health_check, |
|
|
first_value=first_value): |
|
|
first_value=first_value): |
|
|
# this is the health check we're looking for |
|
|
# this is the health check we're looking for |
|
|
return id |
|
|
return id |
|
|
@ -567,15 +572,15 @@ class Route53Provider(BaseProvider): |
|
|
|
|
|
|
|
|
# no existing matches, we need to create a new health check |
|
|
# no existing matches, we need to create a new health check |
|
|
config = { |
|
|
config = { |
|
|
'EnableSNI': True, |
|
|
|
|
|
|
|
|
'EnableSNI': healthcheck_protocol == 'HTTPS', |
|
|
'FailureThreshold': 6, |
|
|
'FailureThreshold': 6, |
|
|
'FullyQualifiedDomainName': healthcheck_host, |
|
|
'FullyQualifiedDomainName': healthcheck_host, |
|
|
'IPAddress': first_value, |
|
|
'IPAddress': first_value, |
|
|
'MeasureLatency': True, |
|
|
'MeasureLatency': True, |
|
|
'Port': 443, |
|
|
|
|
|
|
|
|
'Port': healthcheck_port, |
|
|
'RequestInterval': 10, |
|
|
'RequestInterval': 10, |
|
|
'ResourcePath': healthcheck_path, |
|
|
'ResourcePath': healthcheck_path, |
|
|
'Type': 'HTTPS', |
|
|
|
|
|
|
|
|
'Type': healthcheck_protocol, |
|
|
} |
|
|
} |
|
|
ref = '{}:{}:{}:{}'.format(self.HEALTH_CHECK_VERSION, record._type, |
|
|
ref = '{}:{}:{}:{}'.format(self.HEALTH_CHECK_VERSION, record._type, |
|
|
record.name, uuid4().hex[:16]) |
|
|
record.name, uuid4().hex[:16]) |
|
|
@ -699,6 +704,8 @@ class Route53Provider(BaseProvider): |
|
|
|
|
|
|
|
|
healthcheck_host = record.healthcheck_host |
|
|
healthcheck_host = record.healthcheck_host |
|
|
healthcheck_path = record.healthcheck_path |
|
|
healthcheck_path = record.healthcheck_path |
|
|
|
|
|
healthcheck_protocol = record.healthcheck_protocol |
|
|
|
|
|
healthcheck_port = record.healthcheck_port |
|
|
fqdn = record.fqdn |
|
|
fqdn = record.fqdn |
|
|
|
|
|
|
|
|
# loop through all the r53 rrsets |
|
|
# loop through all the r53 rrsets |
|
|
@ -718,6 +725,8 @@ class Route53Provider(BaseProvider): |
|
|
if caller_ref.startswith(self.HEALTH_CHECK_VERSION): |
|
|
if caller_ref.startswith(self.HEALTH_CHECK_VERSION): |
|
|
if self._health_check_equivilent(healthcheck_host, |
|
|
if self._health_check_equivilent(healthcheck_host, |
|
|
healthcheck_path, |
|
|
healthcheck_path, |
|
|
|
|
|
healthcheck_protocol, |
|
|
|
|
|
healthcheck_port, |
|
|
health_check): |
|
|
health_check): |
|
|
# it has the right health check |
|
|
# it has the right health check |
|
|
continue |
|
|
continue |
|
|
|