From feb3e72893ad5b58553991bc64d610f747176913 Mon Sep 17 00:00:00 2001 From: Oleksandr Holubenko <119401705+dontbreakit@users.noreply.github.com> Date: Fri, 9 Jun 2023 19:41:14 +0300 Subject: [PATCH] fix(CSI-74): no error returned when fetching information from Weka cluster fails (#102) Co-authored-by: Sergey Berezansky --- go.mod | 1 - go.sum | 4 ---- pkg/wekafs/apiclient/apiclient.go | 5 ++++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c8106ed8c..257b13d60 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,6 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/goccy/go-reflect v1.2.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect diff --git a/go.sum b/go.sum index a62131ef5..8c31ec582 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,6 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/goccy/go-reflect v1.2.0 h1:O0T8rZCuNmGXewnATuKYnkL0xm6o8UNOJZd/gOkb9ms= -github.com/goccy/go-reflect v1.2.0/go.mod h1:n0oYZn8VcV2CkWTxi8B9QjkCoq6GTtCEdfmR66YhFtE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= @@ -54,8 +52,6 @@ github.com/prometheus/procfs v0.10.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPH github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= -github.com/showa-93/go-mask v0.5.0 h1:c5wMn8vj04COszRRWpvBNphBwGCoRYKlEKm30THPCn4= -github.com/showa-93/go-mask v0.5.0/go.mod h1:5s1ACflYW3rr6ASzjwY41YdIOqTRqwIGZPPMAxGol4I= github.com/showa-93/go-mask v0.6.0 h1:nNW3dgEocYB7QCGzgRx9wlYrepEg+tRw/keg7u1ftY8= github.com/showa-93/go-mask v0.6.0/go.mod h1:aswIj007gm0EPAzOGES9ACy1jDm3QT08/LPSClMp410= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= diff --git a/pkg/wekafs/apiclient/apiclient.go b/pkg/wekafs/apiclient/apiclient.go index e62b066e9..42521119e 100644 --- a/pkg/wekafs/apiclient/apiclient.go +++ b/pkg/wekafs/apiclient/apiclient.go @@ -449,7 +449,10 @@ func (a *ApiClient) Login(ctx context.Context) error { _ = a.updateTokensExpiryInterval(ctx) } a.refreshTokenExpiryDate = time.Now().Add(time.Duration(a.refreshTokenExpiryInterval) * time.Second) - _ = a.fetchClusterInfo(ctx) + if err := a.fetchClusterInfo(ctx); err != nil { + logger.Error().Err(err).Msg("Failed to fetch information from Weka cluster on login") + return err + } logger.Debug().Msg("Successfully connected to cluster API") return nil }