From ec8bfe4b6d6409cb93e201a8decf197e71e608de Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Mon, 8 Aug 2022 13:23:47 -0400 Subject: [PATCH] CSCGLOBAL: Use slow and safe algorithm (#1663) * Fix broken test * CLOUDFLARE: Fix missing nameserver bug * CSCGLOBAL: Catch more status states * wip! * remove extra print * Revert to the slow+safe CSC algorithm --- providers/cscglobal/api.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/providers/cscglobal/api.go b/providers/cscglobal/api.go index 2cfceebe0..a98b3e923 100644 --- a/providers/cscglobal/api.go +++ b/providers/cscglobal/api.go @@ -391,10 +391,10 @@ func (client *providerClient) sendZoneEditRequest(domainname string, edits []zon // NB(tlim): The request was successfully submitted. The "statusURL" is what we query if we want to wait until the request was processed and see if it was a success. // Right now we don't want to wait. Instead, the next time we do a mutation we wait then. // If we ever change our mind and want to wait for success/failure, it would look like: - //statusURL := errResp.Links.Status - //return client.waitRequestURL(statusURL) + statusURL := errResp.Links.Status + return client.waitRequestURL(statusURL) - return nil + //return nil } func (client *providerClient) waitRequest(reqID string) error { @@ -463,6 +463,9 @@ type pagedZoneEditResponsePagedZoneEditResponse struct { } func (client *providerClient) clearRequests(domain string) error { + if cscDebug { + printer.Printf("DEBUG: Clearing requests\n") + } var bodyString, err = client.get("/zones/edits?filter=zoneName==" + domain) if err != nil { return err @@ -472,7 +475,7 @@ func (client *providerClient) clearRequests(domain string) error { json.Unmarshal(bodyString, &dr) // TODO(tlim): Properly handle paganation. - if dr.Meta.Pages != 1 { + if dr.Meta.Pages > 1 { return fmt.Errorf("cancelPendingEdits failed: Pages=%d", dr.Meta.Pages) }