-
Notifications
You must be signed in to change notification settings - Fork 384
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
Fixed auto-purged cluster behaviour for databricks_library
#1745
Conversation
libraries/libraries_api.go
Outdated
@@ -83,7 +83,7 @@ func (a LibrariesAPI) WaitForLibrariesInstalled(wait Wait) (result *ClusterLibra | |||
return resource.RetryableError(err) | |||
} | |||
if err != nil { | |||
return resource.NonRetryableError(err) | |||
return resource.NonRetryableError(wrapClusterStatusAPIError(err, wait.ClusterID)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, so please simplify the logic here between lines 81 and 87. the new logic should be something like: if we get error from a.ClusterStatus
, return it as non-retriable.
you probably need to directly paste only these lines:
apiErr, ok := err.(common.APIError)
if !ok {
return resource.NonRetryableError(err)
}
// fix non-compliant error code
if apiErr.StatusCode != 404 && strings.Contains(apiErr.Message,
fmt.Sprintf("Cluster %s does not exist", id)) {
apiErr.StatusCode = 404
}
return resource.NonRetryableError(apiErr)
then amount of unit tests will be smaller ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nfx Updated per your suggestion, please review and confirm if we are good.
libraries/libraries_api_test.go
Outdated
_, err = libs.WaitForLibrariesInstalled(Wait{ | ||
"1005-abcd", 50 * time.Millisecond, false, false, | ||
}) | ||
assert.EqualError(t, err, "Cluster 1005-abcd does not exist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also check for 404 StatusCode of APIError here? this is the condition that triggers resource deletion.
databricks_library
Changes to libraries module to address the Issue #1737
The changes enable:
Error: cannot read library: Cluster 1234-123456-u2ab23hh does not exist