Skip to content

Commit

Permalink
Remove "expiration manager is nil on tokenstore" error log for dr sec…
Browse files Browse the repository at this point in the history
…ondary (#22137)

* add check for dr secondary case

* add changelog
  • Loading branch information
akshya96 committed Jul 31, 2023
1 parent 62e2ccd commit 749b139
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/22137.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
core: Remove "expiration manager is nil on tokenstore" error log for unauth requests on DR secondary as they do not have expiration manager.
```
8 changes: 7 additions & 1 deletion vault/token_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1687,8 +1687,14 @@ func (ts *TokenStore) lookupInternal(ctx context.Context, id string, salted, tai
// If we are still restoring the expiration manager, we want to ensure the
// token is not expired
if ts.expiration == nil {
return nil, errors.New("expiration manager is nil on tokenstore")
switch ts.core.IsDRSecondary() {
case true: // Bail if on DR secondary as expiration manager is nil
return nil, nil
default:
return nil, errors.New("expiration manager is nil on tokenstore")
}
}

le, err := ts.expiration.FetchLeaseTimesByToken(ctx, entry)
if err != nil {
return nil, fmt.Errorf("failed to fetch lease times: %w", err)
Expand Down

0 comments on commit 749b139

Please sign in to comment.