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

Bug 2035705: Azure: Only attempt to destroy resourcegroups if present #5516

Merged
merged 1 commit into from Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions pkg/destroy/azure/azure.go
Expand Up @@ -489,14 +489,21 @@ func isNotFoundError(err error) bool {
}

var dErr autorest.DetailedError
if errors.As(err, &dErr) {
switch statusCode := dErr.StatusCode.(type) {
case int:
if statusCode == http.StatusNotFound {
errors.As(err, &dErr)

if dErr.StatusCode == http.StatusNotFound {
return true
}

if dErr.StatusCode == 0 {
serviceErr, ok := dErr.Original.(*azureenv.ServiceError)
if ok {
if strings.HasSuffix(serviceErr.Code, "NotFound") {
return true
}
}
}

return false
}

Expand Down