Skip to content

Commit

Permalink
Merge pull request #5516 from kirankt/bz-2035705
Browse files Browse the repository at this point in the history
Bug 2035705: Azure: Only attempt to destroy resourcegroups if present
  • Loading branch information
openshift-merge-robot committed Jan 18, 2022
2 parents 2f0b6c3 + 8083d2f commit f6ebd26
Showing 1 changed file with 11 additions and 4 deletions.
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

0 comments on commit f6ebd26

Please sign in to comment.