-
Notifications
You must be signed in to change notification settings - Fork 75
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
Refactor metadata CRUD functions to simplify code #473
Conversation
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope I didn't miss some tiny value in this maze, but the tests do pass and Terraform should give another layer of check.
A few notes on capitalization in comments (I was constantly overlooking these but @lvirbalas hopefully fixed them in my head for long):
- Vdc -> VDC (
V
irtualD
ataC
enter) - Org (short for
Org
anization)
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM this maze :) we will see in terraform.
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
…ctor into refactor-metadata Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Enhancements
MergeMetadata
andMergeMetadataAsync
as it is what it does: Updates existing keys, and adds the non-existing ones. The operation was added to all existing supported VCD entities. The input parameter is the MetadatatypedValue
and a map withstring
keys andinterface{}
values, in order to support the different typed values that metadata can handle in VCD.Refactoring
getAdminUrl()
to a more general place, modified its implementation to avoid coupling with Vdc and also avoid a bug when the method is called with sysadmin user.Test_DeleteMetadataForXxxx
. Now both Add/Delete are in the same test:Test_AddAndDeleteMetadataForXxx
to avoid dangling metadata. Anyway, these test will be removed in next major as they test deprecated methods.findFirstVapp()
testing function that didn't return always the defined in configuration vApp. Now it does if present.Testing
Executed
go test -v -tags "metadata"
on VCD 10.3.2