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

Bugfix for UpdateDNSRecord #98

Merged
merged 2 commits into from
Dec 21, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions cmd/flarectl/flarectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ func dnsUpdate(c *cli.Context) {
}
zone := c.String("zone")
recordID := c.String("id")
name := c.String("name")
content := c.String("content")
ttl := c.Int("ttl")
proxy := c.Bool("proxy")
Expand All @@ -418,6 +419,7 @@ func dnsUpdate(c *cli.Context) {

record := cloudflare.DNSRecord{
ID: recordID,
Name: name,
Content: content,
TTL: ttl,
Proxied: proxy,
Expand Down Expand Up @@ -718,6 +720,10 @@ func main() {
Name: "id",
Usage: "record id",
},
cli.StringFlag{
Name: "name",
Usage: "record name",
},
cli.StringFlag{
Name: "content",
Usage: "record content",
Expand Down
6 changes: 5 additions & 1 deletion dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ func (api *API) UpdateDNSRecord(zoneID, recordID string, rr DNSRecord) error {
if err != nil {
return err
}
rr.Name = rec.Name
// Populate the record name from the existing one if the update didn't
// specify it.
if rr.Name == "" {
rr.Name = rec.Name
}
rr.Type = rec.Type
uri := "/zones/" + zoneID + "/dns_records/" + recordID
res, err := api.makeRequest("PUT", uri, rr)
Expand Down