Applying changes per PR feedback -

Check for error conditions from the vSphere API and return the err if one occurs. The vSphere API does not return an err for unauthenticated users, it just returns a nil user object.
This commit is contained in:
Robert Roland 2016-12-06 13:12:49 -08:00
parent 16226c0e18
commit 2cb5b5ec0e

View File

@ -360,8 +360,11 @@ func vSphereLogin(vs *VSphere, ctx context.Context) error {
m := session.NewManager(vs.client.Client)
// retrieve client's current session
u, err := m.UserSession(ctx)
if err == nil && u != nil {
// current session is valid
if err != nil {
glog.Errorf("Error while obtaining user session. err: %q", err)
return err
}
if u != nil {
return nil
}