From 6a1f343de37e5731bd5c323ef57a14d4680c6dc6 Mon Sep 17 00:00:00 2001 From: Shahram Kalantari Date: Tue, 19 Nov 2024 10:10:16 +1000 Subject: [PATCH] chore: address comments Signed-off-by: Shahram Kalantari --- .../azurekeyvault/provider.go | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pkg/keymanagementprovider/azurekeyvault/provider.go b/pkg/keymanagementprovider/azurekeyvault/provider.go index 5d6cedad1..0f23f88b1 100644 --- a/pkg/keymanagementprovider/azurekeyvault/provider.go +++ b/pkg/keymanagementprovider/azurekeyvault/provider.go @@ -459,16 +459,17 @@ func isSecretDisabledError(err error) bool { const SecretDisabledCode = "SecretDisabled" var httpErr *azcore.ResponseError if errors.As(err, &httpErr) { - if httpErr.StatusCode == http.StatusForbidden { - var azureError AzureError - errorResponseBody, readErr := io.ReadAll(httpErr.RawResponse.Body) - if readErr != nil { - return false - } - jsonErr := json.Unmarshal(errorResponseBody, &azureError) - if jsonErr == nil && azureError.Error.Code == ErrorCodeForbidden && azureError.Error.InnerError.Code == SecretDisabledCode { - return true - } + if httpErr.StatusCode != http.StatusForbidden { + return false + } + var azureError AzureError + errorResponseBody, readErr := io.ReadAll(httpErr.RawResponse.Body) + if readErr != nil { + return false + } + jsonErr := json.Unmarshal(errorResponseBody, &azureError) + if jsonErr == nil && azureError.Error.Code == ErrorCodeForbidden && azureError.Error.InnerError.Code == SecretDisabledCode { + return true } }