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

vcsim: workaround xml ns issue with pyvsphere #958

Merged
merged 1 commit into from
Dec 12, 2017
Merged

Conversation

dougm
Copy link
Member

@dougm dougm commented Dec 12, 2017

Fixes #945

typ, ok := vim25MapType(name)
if !ok {
// See TestIssue945, in which case Go does not resolve the namespace and name == "ns1:TraversalSpec"
// Without this hack, the SelectSet would be all nil's
Copy link
Contributor

Choose a reason for hiding this comment

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

need to take a closer look. feels hacky. seems like we are trimming only vim25: as namespace here:

name = strings.TrimPrefix(name, "vim25:")

Copy link
Member Author

Choose a reason for hiding this comment

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

It is a hack, like the comment says. We've only hit this with pyvsphere (not pyvmomi or other clients). I don't want to spend time messing with our fork of the xml package at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

not the xml fork. just TypeFunc in types/registry.go. If you replace the TrimPrefix with SplitN, it should work as well. or maybe we can have a TypeFunc that only trims vim25, and anther that trims all namespaces.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I didn't want to put the hack in the types package. The vim25 check there is valid. But the hack above we shouldn't need at all, as the xml package should be properly resolving the namespace alias.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, i see, there is this: <SOAP-ENV:Body xmlns:ns1="urn:vim25"> missed that.

@dougm dougm merged commit 76f376a into vmware:master Dec 12, 2017
@dougm dougm deleted the issue-945 branch December 12, 2017 20:35
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.

None yet

3 participants