From 88926ad8e9753889e80848b21abeb7ecfb9469fd Mon Sep 17 00:00:00 2001 From: Mark Theunissen Date: Wed, 3 Jul 2024 17:17:20 +1000 Subject: [PATCH] return appropriate error upon tier update for incorrect credentials (#20034) --- cmd/admin-handler-utils.go | 6 ++++++ cmd/tier.go | 6 ++++++ cmd/warm-backend.go | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/admin-handler-utils.go b/cmd/admin-handler-utils.go index 595392771..cdfb79873 100644 --- a/cmd/admin-handler-utils.go +++ b/cmd/admin-handler-utils.go @@ -216,6 +216,12 @@ func toAdminAPIErr(ctx context.Context, err error) APIError { Description: err.Error(), HTTPStatusCode: http.StatusBadRequest, } + case errors.Is(err, errTierInvalidConfig): + apiErr = APIError{ + Code: "XMinioAdminTierInvalidConfig", + Description: err.Error(), + HTTPStatusCode: http.StatusBadRequest, + } default: apiErr = errorCodes.ToAPIErrWithErr(toAdminAPIErrCode(ctx, err), err) } diff --git a/cmd/tier.go b/cmd/tier.go index 48b545453..e7fd93d40 100644 --- a/cmd/tier.go +++ b/cmd/tier.go @@ -64,6 +64,12 @@ var ( Message: "Specified remote backend is not empty", StatusCode: http.StatusBadRequest, } + + errTierInvalidConfig = AdminError{ + Code: "XMinioAdminTierInvalidConfig", + Message: "Unable to setup remote tier, check tier configuration", + StatusCode: http.StatusBadRequest, + } ) const ( diff --git a/cmd/warm-backend.go b/cmd/warm-backend.go index bc17f83b2..2389f3b1f 100644 --- a/cmd/warm-backend.go +++ b/cmd/warm-backend.go @@ -144,7 +144,8 @@ func newWarmBackend(ctx context.Context, tier madmin.TierConfig, probe bool) (d return nil, errTierTypeUnsupported } if err != nil { - return nil, errTierTypeUnsupported + tierLogIf(ctx, err) + return nil, errTierInvalidConfig } if probe {