Skip to content

Commit 8458b63

Browse files
committed
Fixes session active check with datacenter scoped TKG admin account
1 parent 2f371d7 commit 8458b63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/session/session.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ func GetOrCreate(ctx context.Context, params *Params) (*Session, error) {
131131
if cachedSession, ok := sessionCache.Load(sessionKey); ok {
132132
s := cachedSession.(*Session)
133133

134-
vimSessionActive, err := s.SessionManager.SessionIsActive(ctx)
134+
// Retrieve the current session from Managed Object.
135+
// The userSession is active when the value is not nil.
136+
userSession, err := s.SessionManager.UserSession(ctx)
135137
if err != nil {
136138
logger.Error(err, "unable to check if vim session is active")
137139
}
@@ -141,7 +143,7 @@ func GetOrCreate(ctx context.Context, params *Params) (*Session, error) {
141143
logger.Error(err, "unable to check if rest session is active")
142144
}
143145

144-
if vimSessionActive && tagManagerSession != nil {
146+
if userSession != nil && tagManagerSession != nil {
145147
logger.V(2).Info("found active cached vSphere client session")
146148
return s, nil
147149
}

0 commit comments

Comments
 (0)