octodns / octodns-route53

AWS Route53 provider for octoDNS
MIT License
9 stars 20 forks source link

Route 53: Too many values to unpack MX #15

Closed AppleMaster closed 2 years ago

AppleMaster commented 5 years ago

Here's my config:

  config:
    class: octodns.provider.yaml.YamlProvider
    directory: /opt/dns/octozones
    enforce_order: false
  # nsone:
  #   class: octodns.provider.ns1.Ns1Provider
  #   api_key: env/NSONE_KEY
  zonefile:
    class: octodns.source.axfr.ZoneFileSource
    directory: /opt/dns/zonefiles
  route53:
    class: octodns.provider.route53.Route53Provider
    access_key_id: env/AWS_ACCESS_KEY_ID
    secret_access_key: env/AWS_ACCESS_KEY
zones:
  example.com.:
    sources:
      - route53
    targets:
      - config

When I then run octodns-sync against this config, i recieve the following error:

2019-03-28T14:17:39  [140109562977128] INFO  Manager __init__:   max_workers=1
2019-03-28T14:17:39  [140109562977128] INFO  Manager __init__:   max_workers=False
2019-03-28T14:17:40  [140109562977128] INFO  Manager sync: eligible_zones=[], eligible_targets=[], dry_run=True, force=False
2019-03-28T14:17:40  [140109562977128] INFO  Manager sync:   zone=example.com.
2019-03-28T14:17:40  [140109562977128] INFO  Manager sync:   sources=['route53'] -> targets=['config']
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] awards.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] aws.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] beoplay.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] beta.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] bowersandwilkins.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] cdn.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] css.cdn.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] images.cdn.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] community.example.com. is an Alias record. Skipping...
Traceback (most recent call last):
  File "/usr/local/bin/octodns-sync", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/octodns/cmds/sync.py", line 39, in main
    dry_run=not args.doit, force=args.force)
  File "/usr/local/lib/python2.7/site-packages/octodns/manager.py", line 301, in sync
    plans = [p for f in futures for p in f.result()]
  File "/usr/local/lib/python2.7/site-packages/octodns/manager.py", line 56, in result
    return self.func(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/site-packages/octodns/manager.py", line 224, in _populate_and_plan
    source.populate(zone)
  File "/usr/local/lib/python2.7/site-packages/octodns/provider/route53.py", line 491, in populate
    data = getattr(self, '_data_for_{}'.format(record_type))(rrset)
  File "/usr/local/lib/python2.7/site-packages/octodns/provider/route53.py", line 385, in _data_for_MX
    preference, exchange = rr['Value'].split(' ')
ValueError: too many values to unpack

There are only 8 MX records, and a total of 86 record sets in this zone. I have tested on smaller zones with identical MX records and the error does not occur. Similarly, i have tested on larger zones with no MX records, and the error does not occur.

ross commented 5 years ago
preference, exchange = rr['Value'].split(' ')

ValueError: too many values to unpack```

It looks like one of the MXs in this zone has more than a single space in the value which isn't expected. Can you look through them and see if you can spot it? Don't necessary need the exact value if you don't want to share it, just the "shape", words & spaces, of it would do.

AppleMaster commented 5 years ago

Wow. I've gone through the mx records and checked for rogue spaces, one of them in route53 had a value of: 1 mx1.slgnt.eu. which is actually a doublespace - removing it and guaranteeing one space resolved the issue.

Thanks a lot for the extra pair of eyes, I guess assuming my source zone was entirely valid was my mistake :)

ross commented 5 years ago

Wow. I've gone through the mx records and checked for rogue spaces, one of them in route53 had a value of: 1 mx1.slgnt.eu. which is actually a doublespace - removing it and guaranteeing one space resolved the issue.

Cool. That should probably be handled by octoDNS so we can leave this open to track that. It's likel a problem in a bunch of other places as well.

AppleMaster commented 5 years ago

I agree there are probably a few R53 specific cases - another that comes to mind is CNAME's. In R53, a CNAME value doesn't need a trailing . but octodns will expect one when using R53 as a source to another target - which means it fails (as an example).

AppleMaster commented 4 years ago

Hey look at that, been a year since I raised this...Does octodns handle these cases any better yet?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.