Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CreateOrUpdate needs the record name #1341

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1341.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
dns: allow for create or update to actually create the record
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dns: allow for create or update to actually create the record
flarectl: allow for create or update to actually create the record

```
15 changes: 9 additions & 6 deletions cmd/flarectl/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,15 @@ func dnsCreateOrUpdate(c *cli.Context) error {
}
} else {
// Record doesn't exist - create it
rr := cloudflare.CreateDNSRecordParams{}
rr.Type = rtype
rr.Content = content
rr.TTL = ttl
rr.Proxied = &proxy
rr.Priority = &priority
rr := cloudflare.CreateDNSRecordParams{
Name: name,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the initialisation to make it match the dnsCreate method. The key change to fix the bug is line 118, now because the name was not being sent to create which would create a DNS Validation Error (1004)

Type: rtype,
Content: content,
TTL: ttl,
Proxied: &proxy,
Priority: &priority,
}

// TODO: Print the response.
Copy link
Contributor Author

@frankywahl frankywahl Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this TODO (see writeTable function call below) can be removed - but is unrelated to this PR.

result, err = api.CreateDNSRecord(context.Background(), cloudflare.ZoneIdentifier(zoneID), rr)
if err != nil {
Expand Down