New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AWS Route53 Dynamic DNS support #17072

Merged
merged 2 commits into from Oct 13, 2018

Conversation

@keirans
Contributor

keirans commented Oct 2, 2018

Description:

This component adds AWS Route53 dynamic DNS support.

I've tested this and updated the documentation accordingly.

This is my first real Python code, so go easy on me ;)

Example entry for configuration.yaml (if applicable):

route53:
  aws_access_key_id: ABC123
  aws_secret_access_key: DEF456
  zone: ZONEID678
  domain: example.domain.com
  records:
    - vpn
    - hassio
    - home

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
if response['ResponseMetadata']['HTTPStatusCode'] is not 200:
_LOGGER.warning(response)

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

blank line at end of file

changes.append(
{
'Action' : 'UPSERT',
'ResourceRecordSet' : {

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

whitespace before ':'

changes.append(
{
'Action' : 'UPSERT',

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

whitespace before ':'

return
except:
_LOGGER.warning('The ipify logic in the route53 component failed and needs futher investigation')

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

line too long (105 > 79 characters)

Show resolved Hide resolved homeassistant/components/route53.py Outdated
ipaddress = get_ip()
except ConnectionError:
_LOGGER.warning('Unable to reach the ipify service to most likely because of a network error on your end.')

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

line too long (115 > 79 characters)

return True
def _update_route53(aws_access_key_id, aws_secret_access_key, zone, domain, records):

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

line too long (85 > 79 characters)

def update_records_service(now):
"""Set up service for manual trigger."""
_update_route53(aws_access_key_id, aws_secret_access_key, zone, domain, records)

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

line too long (88 > 79 characters)

def update_records_interval(now):
"""Set up recurring update."""
_update_route53(aws_access_key_id, aws_secret_access_key, zone, domain, records)

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

line too long (88 > 79 characters)

import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_time_interval
REQUIREMENTS = ['boto3==1.9.6', 'ipify==1.0.0' ]

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

whitespace before ']'

@keirans keirans referenced this pull request Oct 2, 2018

Merged

Add Route53 component documentation #6439

2 of 2 tasks complete
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_time_interval
REQUIREMENTS = ['boto3==1.9.6','ipify==1.0.0']

This comment has been minimized.

@houndci-bot

houndci-bot Oct 2, 2018

missing whitespace after ','

@homeassistant

This comment has been minimized.

homeassistant commented Oct 2, 2018

Hi @keirans,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@awarecan

This comment has been minimized.

Contributor

awarecan commented Oct 2, 2018

Thanks for your contribution, however I didn't found the reason we need this as part of homeassistant, it is better fit for a hass.io add-on IMO.

@keirans

This comment has been minimized.

Contributor

keirans commented Oct 2, 2018

Hey @awarecan,
Thanks for the review.

This is based on the cloudflare DNS component that is already part of home assistant, alongside duckdns/freedns and a number of other providers.

Given AWS is the biggest cloud provider out there today, it made sense for me to add it.

I have already got this as an add-on, however a number of people i know don't run it as hass, rather under docker directly, so they can't use the add-on.

Let me know what you think,

Cheers,

K

@ludeeus

This comment has been minimized.

Contributor

ludeeus commented Oct 2, 2018

To be honest I disagree, I think this goes well in along side the other services we have like DuckDNS, Namecheap, google, freedns, no-ip, Cloudflare.
https://www.home-assistant.io/components/#network

@bachya bachya added the Hacktoberfest label Oct 2, 2018

@home-assistant home-assistant deleted a comment from homeassistant Oct 3, 2018

@home-assistant home-assistant deleted a comment from homeassistant Oct 3, 2018

Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved homeassistant/components/route53.py Outdated
Show resolved Hide resolved .coveragerc Outdated
@keirans

This comment has been minimized.

Contributor

keirans commented Oct 7, 2018

Hey @fabaff , I've overhauled the code and tested it all works OK.

I've got all the outstanding CI issues resolved and it is ready for your approval and merge into dev.

Let me know if there are any other things i need to do.

Thanks :)

keirans and others added some commits Oct 13, 2018

@fabaff

fabaff approved these changes Oct 13, 2018

@fabaff fabaff merged commit 78e29cd into home-assistant:dev Oct 13, 2018

5 checks passed

Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 93.524%
Details

@wafflebot wafflebot bot removed the in progress label Oct 13, 2018

@balloob balloob referenced this pull request Oct 26, 2018

Merged

0.81 #17809

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment