StackExchange / dnscontrol

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

ORACLE: zone does not exists in profile and will be added automatically #3177

Closed fabienmazieres closed 3 weeks ago

fabienmazieres commented 3 weeks ago

Describe the bug

Most zones I am currently working with trigger the following warning when doing dnscontrol preview:

WARNING: Zone 'example.co.uk' does not exist in the 'oracle' profile and will be added automatically.

Warning message is not displayed when using dnscontrol push or if I add the option --no-populate to the preview:

# dnscontrol preview --config .\dns\example.co.uk.js
******************** Domain: example.co.uk
WARNING: Zone 'example.co.uk' does not exist in the 'oracle' profile and will be added automatically.
Done. 0 corrections.
# dnscontrol preview --config .\dns\example.co.uk.js --no-populate
******************** Domain: example.co.uk
Done. 0 corrections.
# dnscontrol push --config .\dns\example.co.uk.js   
******************** Domain: example.co.uk
Done. 0 corrections.
// @ts-check
/// <reference path="../types-dnscontrol.d.ts" />

var REG_NONE = NewRegistrar("none");
var DSP_ORACLE = NewDnsProvider("oracle");

D("example.co.uk", REG_NONE, DnsProvider(DSP_ORACLE),
  // NO_PURGE indicates that existing records should not be deleted from a domain. Records will be added and updated, but not removed.
  NO_PURGE,

  // Top-level domain configuration
  // NS records may not need to be managed manually, DNSControl gather data from Registrar and applies automatically to the DNS providers

  // Oracle forces name server TTL to be 86400 (1 day)
  // Manually changed in Azure DNS (default = 172800 / 2 days) as DNSControl seems to have trouble to edit root NS records
  NAMESERVER_TTL(86400), // 1 day

  NAMESERVER("ns4.p201.dns.oraclecloud.net."),
  NAMESERVER("ns1.p201.dns.oraclecloud.net."),
  NAMESERVER("ns2.p201.dns.oraclecloud.net."),
  NAMESERVER("ns3.p201.dns.oraclecloud.net."),

  DefaultTTL(3600),
  TXT("_dmarc", "v=DMARC1;p=none;sp=none;adkim=s;aspf=s;fo=1;rua=mailto:dmarc@example.com"),
  TXT("_domainkey", "v=DKIM1; p="),
  MX("@", 0, "domain.invalid."),
  TXT("@", "V=spf1 -all"),

  END
);

To Reproduce

Unsure, I added some new zone to work with using dnscontrol get-zones and they all seem to trigger this message. An older zone does not have the issue

Expected behavior

No Warning message displayed when zone already exists.

DNS Provider

Additional context

@tlimoncelli I am not sure where to start on this one, I would appreciate any help to understand the logic and flow behind this warning message

fabienmazieres commented 3 weeks ago

ok, I think I figured it out. I found the error message in function run() in previewPush.go, where we check if the zone is part of the list of zone from the provider. Going to function ListZones() in oracleProvider.go, I added some debug to find out my list of zone was a lot shorter than expected, there was only 50 records instead of 80+ zone we have.

I added support for pagination in the code in #3179

tlimoncelli commented 3 weeks ago

ok, I think I figured it out. I found the error message in function run() in previewPush.go, where we check if the zone is part of the list of zone from the provider. Going to function ListZones() in oracleProvider.go, I added some debug to find out my list of zone was a lot shorter than expected, there was only 50 records instead of 80+ zone we have.

I added support for pagination in the code in #3179

Great detective work!