Skip to content

Commit

Permalink
sdk/client: fixing an issue when parsing the OData from the API Response
Browse files Browse the repository at this point in the history
Databricks @ 2023-02-01 returns a literal empty string from the initial Delete
operation: #436
  • Loading branch information
tombuildsstuff committed Aug 1, 2023
1 parent 72beed9 commit 100aa47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 3 additions & 4 deletions sdk/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,9 @@ func (c *Client) Execute(ctx context.Context, req *Request) (*Response, error) {
return true, nil
}

o, err := odata.FromResponse(r)
if err != nil {
return false, err
}
// Extract OData from response, intentionally ignoring any errors as it's not crucial to extract
// valid OData at this point (valid json can still error here, such as any non-object literal)
o, _ := odata.FromResponse(r)

if f := req.RetryFunc; f != nil {
shouldRetry, err := f(r, o)
Expand Down
12 changes: 8 additions & 4 deletions sdk/client/resourcemanager/poller_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,16 @@ func (p deletePoller) Poll(ctx context.Context) (result *pollers.PollResult, err
if resp.Response != nil {
switch resp.StatusCode {
case http.StatusNotFound:
result.Status = pollers.PollingStatusSucceeded
return
{
result.Status = pollers.PollingStatusSucceeded
return
}

case http.StatusOK:
result.Status = pollers.PollingStatusInProgress
return
{
result.Status = pollers.PollingStatusInProgress
return
}
}

err = fmt.Errorf("unexpected status code when polling for resource after deletion, expected a 200/204 but got %d", resp.StatusCode)
Expand Down

0 comments on commit 100aa47

Please sign in to comment.