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

ImporterWrapper: Allocate a new Importer object (#1481) #1486

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

salv-orlando
Copy link
Member

The wrapper function was updating the existing importer, but the replaced function ended up having the same pointer as the wrapper function, meaning that import would enter an infinite recursion loop.

Tested by doing import, read, update, and delete for

  1. nsxt_logical_tier1_router
  2. nsxt_ip_pool

The wrapper function was updating the existing importer, but the replaced
function ended up having the same pointer as the wrapper function, meaning
that import would enter an infinite recursion loop.

Tested by doing import, read, update, and delete for
1) nsxt_logical_tier1_router
2) nsxt_ip_pool

Signed-off-by: Salvatore Orlando <[email protected]>
@@ -66,15 +66,18 @@ func deleteWrapper(originalFunc schema.DeleteFunc, name string) schema.DeleteFun
}

func importerWrapper(originalImporter *schema.ResourceImporter, name string) *schema.ResourceImporter {
newImporter := new(schema.ResourceImporter)
Copy link
Collaborator

Choose a reason for hiding this comment

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

would it be more straightforward to return originalImporter here, and let the Read fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

that was the previous code.
Probably you meant do not wrapping the importer at all and let import fail at read?

@salv-orlando salv-orlando merged commit f626dd0 into vmware:master Dec 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants