vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
80 stars 76 forks source link

vdc.GetMetadata() has index issues when accessing the vdcs as a system org user #461

Closed bogi0704 closed 2 years ago

bogi0704 commented 2 years ago

Describe the bug

I am using the vdc.GetMetadata() funtion as a user belonging to the system organization. I get the following error when calling this as a system user:

runtime error: index out of range [1] with length 1

This is happening because the function GetMetadata() uses the function getAdminVdcURL to get the admin url. But the url this function gets is already an admin url, since I am accessing the Metadata as a system user.

Reproduction steps

1. Authenticate as a system org user
2. try to call vdc.GetMetadata()

Expected behavior

The vdc.GetMetadata() should be able to distinguish if it needs to get the admin url or just use the one that the vdc object has.

Additional context

I will open a pull request to fix this issue.

adambarreiro commented 2 years ago

Closing as done in #473