Skip to content

Commit c80756f

Browse files
committed
azure: Check for nil in case of proxy crash/deleted
In case the proxy is brought down, the installer tries to destroy cluster that was behind the proxy and ends up panicking. Adding a small nil check to avoid this.
1 parent 24d2481 commit c80756f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/destroy/azure/azure.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,11 @@ func isAuthError(err error) bool {
676676
// https://github.com/Azure/azure-sdk-for-go/blob/sdk/azidentity/v1.1.0/sdk/azidentity/errors.go#L36
677677
var authErr *azidentity.AuthenticationFailedError
678678
if errors.As(err, &authErr) {
679-
if authErr.RawResponse.StatusCode >= 400 && authErr.RawResponse.StatusCode <= 403 {
679+
if authErr.RawResponse == nil {
680+
// Unable to get a proper response, probably due to some proxy error. Fixing this piece of code
681+
// so it doesn't throw a panic.
682+
return true
683+
} else if authErr.RawResponse.StatusCode >= 400 && authErr.RawResponse.StatusCode <= 403 {
680684
return true
681685
}
682686
}

0 commit comments

Comments
 (0)