diff --git a/vault/expiration.go b/vault/expiration.go index a56e7fcb2e68..0db360ca511f 100644 --- a/vault/expiration.go +++ b/vault/expiration.go @@ -307,6 +307,10 @@ func (m *ExpirationManager) Restore(errorFunc func()) (retErr error) { switch { case retErr == nil: + case errwrap.Contains(retErr, context.Canceled.Error()): + // Don't run error func because we lost leadership + m.logger.Warn("context cancled while restoring leases, stopping lease loading") + retErr = nil case errwrap.Contains(retErr, ErrBarrierSealed.Error()): // Don't run error func because we're likely already shutting down m.logger.Warn("barrier sealed while restoring leases, stopping lease loading")