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

logout session #24

Open
wants to merge 1 commit into
base: spectro-v1alpha4
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ RELEASE_CONTROLLER_IMG := $(RELEASE_REGISTRY)/$(IMAGE_NAME)
# Development Docker variables
DEV_REGISTRY ?= gcr.io/spectro-dev-public/release/cluster-api-provider-vsphere
DEV_CONTROLLER_IMG ?= $(DEV_REGISTRY)/cluster-api-vsphere-controller
DEV_TAG ?= spectro-v0.8.1-20220607
DEV_TAG ?= spectro-v0.8.1-20220723
DEV_MANIFEST_IMG := $(DEV_CONTROLLER_IMG)

# Set build time variables including git version details
Expand Down
25 changes: 6 additions & 19 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,29 +235,16 @@ func clearCache(logger logr.Logger, sessionKey string) {
if cachedSession, ok := sessionCache.Load(sessionKey); ok {
s := cachedSession.(*Session)

// check for the presence of tagmanager session
// since calling Logout on an expired session blocks
session, err := s.TagManager.Session(context.Background())
logger.V(0).Info("tag manager session, logging out")
err := s.TagManager.Logout(context.Background())
if err != nil {
logger.Error(err, "unable to get tag manager session")
}
if session != nil {
logger.V(6).Info("found active tag manager session, logging out")
err := s.TagManager.Logout(context.Background())
if err != nil {
logger.Error(err, "unable to logout tag manager session")
}
logger.Error(err, "unable to logout tag manager session")
}

vimSessionActive, err := s.SessionManager.SessionIsActive(context.Background())
logger.V(0).Info("vim session, logging out")
err = s.SessionManager.Logout(context.Background())
if err != nil {
logger.Error(err, "unable to get vim client session")
} else if vimSessionActive {
logger.V(0).Info("found active vim session, logging out")
err := s.SessionManager.Logout(context.Background())
if err != nil {
logger.Error(err, "unable to logout vim session")
}
logger.Error(err, "unable to logout vim session")
}
}
logger.V(0).Info("session cache flushed")
Expand Down