StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.13k stars 397 forks source link

Dnsimple does not handle paging properly. #241

Closed stephencornelius closed 7 years ago

stephencornelius commented 7 years ago

Hi,

Ive setup about 40 DNS records and successfully added them to dnsimple with all records reporting as SUCCESS but when running preview again 17 records are showing as needing to be created. Running push they all fail with "400 Zone already exists". I can see them in the dnsimple gui as well.

Any ideas what could be wrong? I tried creating the same records on NS1 and that worked fine.

Thanks

tlimoncelli commented 7 years ago

Can you share your dnsconfig.js file? (removing any proprietary bits if there are any, of course)

tlimoncelli commented 7 years ago

CC: @aeden

aeden commented 7 years ago

@stephencornelius I will try to pull down the latest and see if I can reproduce. Your sanitized dnsconfig.js may be helpful.

onlyhavecans commented 7 years ago

I just updated & re-ran my dscontrol preview & push and was unable to replicate the issue. Can you post configurations as recommended above so we can help troubleshoot? I even made some record modify's and then ran a clean preview & push with no issues.

My config is set up as such (with some editing) and works without issue. So I'm providing it just so we have a reference point

// Providers:

var REG_NONE = NewRegistrar('none', 'NONE');    // No registrar.
var DNS_BIND = NewDnsProvider('bind', 'BIND');  // ISC BIND.

var REG_DNSIMPLE = NewRegistrar('dnsimple_wagthattail', 'DNSIMPLE');
var DNSIMPLE = NewDnsProvider('dnsimple_wagthattail', 'DNSIMPLE');

DEFAULTS(DefaultTTL(3600));

// Domains:
// DNSimple Registered:

D('mydomainwithnorecords.moe', REG_DNSIMPLE, DnsProvider(DNSIMPLE))

D('squirrel.photography', REG_DNSIMPLE, DnsProvider(DNSIMPLE),
  A('@', '66.6.44.4')
)

D('testdomain.wtf', REG_DNSIMPLE, DnsProvider(DNSIMPLE),
  A('@',         '207.254.50.189'),
  A('bunni2013', '192.168.1.2'),
  A('cheftest',  '192.241.167.97'),
  A('chekk',     '69.172.231.26'),
  A('stash',     '107.170.251.248'),
  A('test',      '1.2.3.4', TTL(60))
)

// Register4Less Registered:

OLDSERVER=[
  A('@', '66.172.12.229'),
  A('mail', '66.172.12.229'),
  CNAME('www', '@'),
  TXT('@', 'v=spf1 mx a:ns2.r4l.com ~all')
]

D('olddomain.com', REG_NONE, DnsProvider(DNSIMPLE),
  OLDSERVER
)
stephencornelius commented 7 years ago

thanks for taking a look, my config is below. have changed both the names and targets so if youre unable to recreate with it would suggest theres something specific in my config causing it, although the records that were showing as not created when they were were throughout the config:

var REG_NONE = NewRegistrar("none","NONE");
var DNSIMPLE = NewDnsProvider("dnsimple", "DNSIMPLE");

D("domain.com",REG_NONE, DnsProvider(DNSIMPLE), NO_PURGE, {"ns_ttl": "3600"},
  DefaultTTL(300),
  MX("@", 10, "aspmx.l.google.com.", TTL(3600)),
  MX("@", 20, "alt1.aspmx.l.google.com.", TTL(3600)),
  MX("@", 20, "alt2.aspmx.l.google.com.", TTL(3600)),
  MX("@", 30, "aspmx2.googlemail.com.", TTL(3600)),
  MX("@", 30, "aspmx3.googlemail.com.", TTL(3600)),
  TXT("@", "google-site-verification=", TTL(3600)),
  TXT("@", "v=spf1 include:_spf.google.com ~all", TTL(3600)),
  A("monitor", "10.11.12.13"),
  CNAME("al", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("api", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("apis", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("apiz", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("bo", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("cy", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("cyp", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("dash", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("dashb", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("dashd", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("dashl", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("dev", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("email", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("email.te", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("gr", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("imap", "imap.secureserver.net."),
  CNAME("in", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("mail", "pop.secureserver.net."),
  CNAME("new", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("pop", "pop.secureserver.net."),
  CNAME("prom", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("resource", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("smtp", "smtp.secureserver.net."),
  CNAME("staging", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("tasks", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("test", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("us", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("usc", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("web", "elb.eu-west-1.elb.amazonaws.com."),
  CNAME("www", "elb.eu-west-1.elb.amazonaws.com."),
  MX("te", 10, "mxa.mailgun.org.", TTL(3600)),
  MX("te", 10, "mxb.mailgun.org.", TTL(3600)),
  TXT("te", "v=spf1 include:mailgun.org ~all", TTL(3600)),
  TXT("smtp._domainkey.te", "k=rsa; p=MIG", TTL(3600))
);

thanks

captncraig commented 7 years ago

My first instinct was that this kind of thing can happen if you use an fqdn as a record name, as in

D("example.com",...,
A("foo.example.com", "1.2.3.4"))

but that does not appear to be the case with your snippet.

stephencornelius commented 7 years ago

no, havent got a fqdn as a record name

onlyhavecans commented 7 years ago

I copied your config as posted and changed the domain to one of the placeholders I own and was able to replicate the issue. The problem is ONLY happening with this record set, not any of my other ones so this will require more looking into.

captncraig commented 7 years ago

It is a paging issue. The api only gives us back some of the records at a time, so dnscontrol assumes they don't exist.

The integration tests would expose this, but those are not working with recent changes either. I can fix this.

captncraig commented 7 years ago

I think I fixed it. Integration tests are passing for dnsimple now for me. Can you pull master and confirm it works now?

onlyhavecans commented 7 years ago

I tested with the provided data and no longer have any errors 👍 @stephencornelius can you confirm you are also good to go?

stephencornelius commented 7 years ago

sorry for the delay, can confirm its all working.

is there any chance of getting a new release published?

many thanks for the quick fix

captncraig commented 7 years ago

Sure thing. https://github.com/StackExchange/dnscontrol/releases/tag/v0.2.3