Browse Source

Add a Name tag to Route53 healthchecks for UI purposes

pull/333/head
Ross McFarland 7 years ago
parent
commit
f83eeb0a9c
No known key found for this signature in database GPG Key ID: 61C10C4FC8FE4A89
2 changed files with 17 additions and 0 deletions
  1. +14
    -0
      octodns/provider/route53.py
  2. +3
    -0
      tests/test_octodns_provider_route53.py

+ 14
- 0
octodns/provider/route53.py View File

@ -640,6 +640,20 @@ class Route53Provider(BaseProvider):
HealthCheckConfig=config) HealthCheckConfig=config)
health_check = resp['HealthCheck'] health_check = resp['HealthCheck']
id = health_check['Id'] id = health_check['Id']
# Set a Name for the benefit of the UI
name = '{}:{} - {}'.format(record.fqdn, record._type, value)
self._conn.change_tags_for_resource(ResourceType='healthcheck',
ResourceId=id,
AddTags=[{
'Key': 'Name',
'Value': name,
}])
# Manually add it to our cache
health_check['Tags'] = {
'Name': name
}
# store the new health check so that we'll be able to find it in the # store the new health check so that we'll be able to find it in the
# future # future
self._health_checks[id] = health_check self._health_checks[id] = health_check


+ 3
- 0
tests/test_octodns_provider_route53.py View File

@ -841,6 +841,7 @@ class TestRoute53Provider(TestCase):
'CallerReference': ANY, 'CallerReference': ANY,
'HealthCheckConfig': health_check_config, 'HealthCheckConfig': health_check_config,
}) })
stubber.add_response('change_tags_for_resource', {})
record = Record.new(self.expected, '', { record = Record.new(self.expected, '', {
'ttl': 61, 'ttl': 61,
@ -947,6 +948,8 @@ class TestRoute53Provider(TestCase):
'CallerReference': ANY, 'CallerReference': ANY,
'HealthCheckConfig': health_check_config, 'HealthCheckConfig': health_check_config,
}) })
stubber.add_response('change_tags_for_resource', {})
stubber.add_response('change_tags_for_resource', {})
record = Record.new(self.expected, 'a', { record = Record.new(self.expected, 'a', {
'ttl': 61, 'ttl': 61,


Loading…
Cancel
Save