VULTR provider: domain not created in web admin causes a panic on preview command
Describe the bug If you have not created the domain in the vultr DNS page, the dnscontrol preview command will crash(see additional context)
To Reproduce create dnscontrol.js like below, run dnscontrol preview
Expected behavior An error saying, hey dummy! You forgot to create the domain in the vutlr DNS panel (or alternatively, just create the domain).
DNS Provider
- VULTR
Additional context
dnscontrol.js:
var REG_NONE = NewRegistrar(""); // No registrar.
var DSP_VULTR = NewDnsProvider("vultr");
// Domains:
D("example.com", REG_NONE, DnsProvider(DSP_VULTR), A("@", "1.2.3.4"));
% dnscontrol preview ******************** Domain: example.com panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1058c682c]
goroutine 1 [running]: github.com/StackExchange/dnscontrol/v4/providers/vultr.(*vultrProvider).GetZoneRecords(0x140009ba558, {0x14000c98c05, 0xb}, 0x1058daa6d?) github.com/StackExchange/dnscontrol/v4/providers/vultr/vultrProvider.go:84 +0x8c github.com/StackExchange/dnscontrol/v4/pkg/zonerecs.CorrectZoneRecords({0x12dd17a58, 0x140009ba558}, 0x14001014700) github.com/StackExchange/dnscontrol/v4/pkg/zonerecs/zonerecords.go:12 +0x48 github.com/StackExchange/dnscontrol/v4/commands.run.func1(0x0?, 0x14000e9f798, 0x14000e9f728, {0x10617adb0, 0x106c4b980}, 0x0, 0x14000e9f6c6, 0x14000e9f6c8, {0x106161228, 0x140009ba570}, ...) github.com/StackExchange/dnscontrol/v4/commands/previewPush.go:250 +0x530 github.com/StackExchange/dnscontrol/v4/commands.run({{{{0x1058d8a19, 0xc}, {0x0, 0x0}, 0x0, {{...}, {...}, 0x0, 0x0}}, {0x0, ...}}, ...}, ...) github.com/StackExchange/dnscontrol/v4/commands/previewPush.go:290 +0x278 github.com/StackExchange/dnscontrol/v4/commands.Preview(...) github.com/StackExchange/dnscontrol/v4/commands/previewPush.go:134 github.com/StackExchange/dnscontrol/v4/commands.init.func8.1(0x1400091ee00?) github.com/StackExchange/dnscontrol/v4/commands/previewPush.go:32 +0x90 github.com/urfave/cli/v2.(*Command).Run(0x14000852000, 0x1400091ee00, {0x14000785b60, 0x1, 0x1}) github.com/urfave/cli/[email protected]/command.go:276 +0x71c github.com/urfave/cli/v2.(*Command).Run(0x140007b42c0, 0x1400091ebc0, {0x140001c2000, 0x2, 0x2}) github.com/urfave/cli/[email protected]/command.go:269 +0x918 github.com/urfave/cli/v2.(*App).RunContext(0x1400091c200, {0x10616d790, 0x106cf3ec0}, {0x140001c2000, 0x2, 0x2}) github.com/urfave/cli/[email protected]/app.go:333 +0x514 github.com/urfave/cli/v2.(*App).Run(...) github.com/urfave/cli/[email protected]/app.go:307 github.com/StackExchange/dnscontrol/v4/commands.Run({0x140000445c0?, 0x1058e5182?}) github.com/StackExchange/dnscontrol/v4/commands/commands.go:105 +0x444 main.main() github.com/StackExchange/dnscontrol/v4/main.go:30 +0xbc
CC @pgaskin (maintainer of the VULTR provider)