route53 - support updating base domain (#39264)

This commit is contained in:
arunderwood 2020-08-31 05:48:55 -04:00 committed by GitHub
parent bba8b8e759
commit 84205a9a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,6 +66,12 @@ def setup(hass, config):
return True
def _get_fqdn(record, domain):
if record == ".":
return domain
return f"{record}.{domain}"
def _update_route53(
aws_access_key_id: str,
aws_secret_access_key: str,
@ -98,7 +104,7 @@ def _update_route53(
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": f"{record}.{domain}",
"Name": _get_fqdn(record, domain),
"Type": "A",
"TTL": ttl,
"ResourceRecords": [{"Value": ipaddress}],