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

Ignore AcquireLocalTicket errors #955

Merged
merged 1 commit into from
Dec 12, 2017
Merged

Ignore AcquireLocalTicket errors #955

merged 1 commit into from
Dec 12, 2017

Conversation

dougm
Copy link
Member

@dougm dougm commented Dec 11, 2017

If no username is provided, the govc client tries to acquire a local ticket.
When invoked remotely, ESX returns an InvalidRequestFault (VC returns NotSupportedFault).
So, rather than return an error here, fallthrough to Login() with the original User to
to avoid what would be a confusing error message.

Don't try AcquireLocalTicket at all against vCenter as it is unsupported.

Fixes #952

return nil, err
if u.Username() == "" && !c.IsVC() {
// If no username is provided, try to acquire a local ticket.
// When invoked remotely, ESX returns an InvalidRequestFault (VC returns NotSupportedFault).
Copy link
Contributor

Choose a reason for hiding this comment

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

this parenthetical is slightly confusing considering the conditional on line 431 excludes this path for VC.

elaborate or remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed. Thanks for reviewing Brad!

@bradfitz
Copy link
Contributor

Code LGTM. Thanks for the fix!

If no username is provided, the govc client tries to acquire a local ticket.
When invoked remotely, ESX returns an InvalidRequestFault (VC returns NotSupportedFault).
So, rather than return an error here, fallthrough to Login() with the original User to
to avoid what would be a confusing error message.

Don't try AcquireLocalTicket at all against vCenter as it is unsupported.

Fixes vmware#952
// If no username is provided, try to acquire a local ticket.
// When invoked remotely, ESX returns an InvalidRequestFault.
// So, rather than return an error here, fallthrough to Login() with the original User to
// to avoid what would be a confusing error message.
Copy link
Contributor

@anfernee anfernee Dec 11, 2017

Choose a reason for hiding this comment

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

so when error happens here, we login with empty user, and get something like LoginFault, which is less confusing. Is that accurate?

Copy link
Member Author

Choose a reason for hiding this comment

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

exactly, InvalidLoginFault with the appropriate localized message.

@dougm dougm merged commit a1c4929 into vmware:master Dec 12, 2017
@dougm dougm deleted the issue-952 branch December 12, 2017 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants