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

Bad conditional in vSphereLogin function #36169

Merged
merged 2 commits into from
Dec 13, 2016

Conversation

robdaemon
Copy link

@robdaemon robdaemon commented Nov 3, 2016

Fixes NotAuthenticated errors that appear in the kubelet and kube-controller-manager due to never logging in to vSphere

With this conditional being == instead of !=, a login would never actually be attempted by this provider, and disk attachments would fail with a NotAuthenticated error from vSphere.


This change is Reviewable

With this conditional being == instead of !=, a login would never actually be attempted by this provider, and disk attachments would fail.
@k8s-ci-robot
Copy link
Contributor

Can a kubernetes member verify that this patch is reasonable to test? If so, please reply with "@k8s-bot ok to test" on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands will still work. Regular contributors should join the org to skip this step.

If you have questions or suggestions related to this bot's behavior, please file an issue against the kubernetes/test-infra repository.

@robdaemon
Copy link
Author

I'm pretty sure HPE has a signed CLA with the Linux Foundation?

@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-label-needed labels Nov 3, 2016
@grahamhayes
Copy link
Contributor

@k8s-bot ok to test

@robdaemon
Copy link
Author

There, Linux Foundation CLA signed

@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Nov 11, 2016
@apelisse apelisse removed the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Nov 11, 2016
@robdaemon
Copy link
Author

What else is needed to get this PR through? I'm not sure how anyone is using Kubernetes on vSphere right now :)

@grahamhayes
Copy link
Contributor

@k8s-bot approvers

@@ -360,7 +360,7 @@ 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 {
if err == nil && u != nil {
Copy link
Contributor

@abrarshivani abrarshivani Dec 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robdaemon Thanks for doing this. This will create user session even if it fails to obtain the existing one. So, I would suggest you to do like following,

. . .

if err != nil {
	glog.Errorf("Error while obtaining user session. err: %q", err)
	return err
}

if u != nil {
	return nil
}

. . . 

This will handle the error. You can check conditions here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've made the changes you request here.

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.
@abrarshivani
Copy link
Contributor

LGTM

@k8s-github-robot k8s-github-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels Dec 10, 2016
@kerneltime
Copy link

@k8s-bot ok to test

@kerneltime
Copy link

@mikedanese Can this be merged in once the tests pass?

@mikedanese
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 13, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 6c059cb into kubernetes:master Dec 13, 2016
k8s-github-robot pushed a commit that referenced this pull request Jan 12, 2017
…-kubernetes-release-1.5

Automatic merge from submit-queue

Automated cherry pick of #36169

Cherry pick of #36169 on release-1.5.

#36169: Bad conditional in vSphereLogin function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants