Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: account for etcd leader changes error #5003

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/handlers/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func RequireValidSessionQuietMiddleware(kotsStore store.Store) mux.MiddlewareFun
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sess, err := requireValidSession(kotsStore, w, r)
if err != nil {
logger.Errorf("failed validating session: %s", err)
return
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func requireValidSession(kotsStore store.Store, w http.ResponseWriter, r *http.R
passwordUpdatedAt, err := kotsStore.GetPasswordUpdatedAt()
if err != nil {
response := types.ErrorResponse{Error: util.StrPointer("failed to validate session with current password")}
JSON(w, http.StatusUnauthorized, response)
JSON(w, http.StatusInternalServerError, response)
return nil, err
}
if passwordUpdatedAt != nil && passwordUpdatedAt.After(sess.IssuedAt) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func Test_requireValidSession_FailedToFetchPasswordUpdated_AfterSessionIssuedErr
req.Error(err)
req.Equal("failed to fetch password updatedAt", err.Error())
req.Equal(want, got)
req.Equal(401, w.Code)
req.Equal(500, w.Code)
}

func Test_requireValidSession_PasswordUpdated_AfterSessionIssuedErr(t *testing.T) {
Expand Down
Loading