Skip to content

Commit

Permalink
Merge pull request #585 from hashicorp/b/polling-databricks
Browse files Browse the repository at this point in the history
sdk/client: fixing an issue when parsing the OData from the API Response
  • Loading branch information
tombuildsstuff authored Aug 1, 2023
2 parents 45214f0 + 100aa47 commit d608923
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 d608923

Please sign in to comment.