vultr/vultr-cli

[BUG] - Error when creating DNS record CAA

Closed this issue · 2 comments

Describe the bug
when trying to create a DNS record with the vultr-CLI
command: vultr-cli dns record create "domain" --name @ --type CAA --ttl 3600 --priority 0 --data 0 issuewild "letsencrypt.org."

Error message: Error: error creating domain record : {"error":"Unable to add record: Data must be in the format: [flag] [iodef|issuewild|issue] "domain"","status":400}

alternatively It works on the web console with the same data entry: 0 issuewild "letsencrypt.org."

To Reproduce
Steps to reproduce the behavior:

  1. open prompt
  2. type the command above including domain
  3. See error

Expected behavior
to be able to create the dns record and see the results in the prompt and in the online console

@michelgirault due to the way cobra parses command line flags, the data for the example command you provided would strip everything after the first space, leaving only 0. If you pass it but enclose the data in quotes, it works:

vultr-cli dns record create <domain> --name @ --type CAA --ttl 3600 --priority 0 --data='0 issuewild "letsencrypt.org."'                                                                 
ID                                      TYPE    NAME    DATA                            PRIORITY        TTL
d32f370a-1a3c-435c-af9e-67ee8fac3a88    CAA             0 issuewild "letsencrypt.org."  0               3600

@michelgirault due to the way cobra parses command line flags, the data for the example command you provided would strip everything after the first space, leaving only 0. If you pass it but enclose the data in quotes, it works:

vultr-cli dns record create <domain> --name @ --type CAA --ttl 3600 --priority 0 --data='0 issuewild "letsencrypt.org."'                                                                 
ID                                      TYPE    NAME    DATA                            PRIORITY        TTL
d32f370a-1a3c-435c-af9e-67ee8fac3a88    CAA             0 issuewild "letsencrypt.org."  0               3600

Thanks a lot, thats correct its works for me