diff --git a/cli/record/new.go b/cli/record/new.go index 5819bcdd..f494056c 100644 --- a/cli/record/new.go +++ b/cli/record/new.go @@ -72,10 +72,21 @@ You may also invoke this command in "wizard" mode and be prompted for input } if internal.AutoDNSRecord { - logrus.Infof("automatically configuring @./*. A records for %s (--auto)", zone) - if err := autoConfigure(c, &provider, zone); err != nil { + ipv4, err := dns.EnsureIPv4(zone) + if err != nil { + logrus.Debugf("no ipv4 associated with %s, prompting for input", zone) + if err := internal.EnsureDNSValueFlag(c); err != nil { + logrus.Fatal(err) + } + ipv4 = internal.DNSValue + } + + logrus.Infof("automatically configuring @./*. A records for %s for %s (--auto)", zone, ipv4) + + if err := autoConfigure(c, &provider, zone, ipv4); err != nil { logrus.Fatal(err) } + return nil } @@ -159,12 +170,7 @@ You may also invoke this command in "wizard" mode and be prompted for input }, } -func autoConfigure(c *cli.Context, provider *gandi.Provider, zone string) error { - ipv4, err := dns.EnsureIPv4(zone) - if err != nil { - return err - } - +func autoConfigure(c *cli.Context, provider *gandi.Provider, zone, ipv4 string) error { ttl, err := dns.GetTTL(internal.DNSTTL) if err != nil { return err