clear the token

This commit is contained in:
Alex Dadgar
2017-10-23 15:11:13 -07:00
parent 7095545490
commit e0a9dc1c58
2 changed files with 4 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ func (s *Server) ResolveToken(secretID string) (*acl.ACL, error) {
// Check if the secret ID is the leader secret ID, in which case treat it as
// a management token.
if secretID == s.getLeaderAcl() {
if leaderAcl := s.getLeaderAcl(); leaderAcl != "" && secretID == leaderAcl {
return acl.ManagementACL, nil
}

View File

@@ -522,6 +522,9 @@ func (s *Server) periodicUnblockFailedEvals(stopCh chan struct{}) {
// revokeLeadership is invoked once we step down as leader.
// This is used to cleanup any state that may be specific to a leader.
func (s *Server) revokeLeadership() error {
// Clear the leader token since we are no longer the leader.
s.setLeaderAcl("")
// Disable the plan queue, since we are no longer leader
s.planQueue.SetEnabled(false)