Fix GRE tunnel create check and Exists error handling - #2239
Open
ksamoray wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
/test-all |
ksamoray
force-pushed
the
b3122/fix/2207-gre-tunnel-create-check
branch
from
September 3, 2026 09:49
8b7cf77 to
c952b46
Compare
resourceNsxtPolicyTier0GatewayGRETunnelExists returned true, nil for any non-not-found error, including real API failures. Create also never checked for a colliding explicit nsx_id before issuing the Patch, silently overwriting an existing GRE tunnel instead of rejecting the create. Fix Exists to only report true when the Get succeeds, propagate real errors instead of misreporting them as existing, and have Create reject a colliding explicit nsx_id up front.
ksamoray
force-pushed
the
b3122/fix/2207-gre-tunnel-create-check
branch
from
September 8, 2026 10:46
c952b46 to
c2d8b6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resourceNsxtPolicyTier0GatewayGRETunnelExistsreturnedtrue, nilfor any non-not-found error, including real API failures.Createnever checked for a colliding explicitnsx_idbefore issuing the Patch, silently overwriting an existing GRE tunnel instead of rejecting the create.Existsto only reporttruewhen theGetsucceeds, propagate real errors instead of misreporting them as existing, and haveCreatereject a colliding explicitnsx_idup front.Hand-adapted port of the equivalent master fix: master's version of this file uses a different (SDK-wrapper-refactor) client-construction pattern not present on this branch, and the full source PR (#2207) bundled this fix with an unrelated 36-file "move test-only Exists helpers into
_test.gofiles" refactor touching many resources absent from this branch (including several Transit-Gateway-routing-child resources). Only the isolated GRE tunnel logic fix is included here, rewritten against this branch's actual client-construction code.Test plan
go build ./...go vet ./...gofmt -l .(clean)golangci-lint run ./nsxt/(0 issues)Note: CI's
lintjob'smake toolsstep was previously expected to fail on PRs against this branch pending #2234's Go-version bump — that has since merged, so this should be unaffected.