fix(resource): also ignore no such element err #194
Merged
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.
Description of your changes
Since
crossplane-runtime
might also return a "no such element" error, we must also interpret that case, and ignore it in order to patch the existing array with a new element.https://github.com/crossplane/crossplane-runtime/blob/19d95a69cc03690c4b867ff91d89681fcf872a93/pkg/fieldpath/paved.go#L124-L126
Previous to this change, we only dealt with the "no such field" error:
https://github.com/crossplane/crossplane-runtime/blob/19d95a69cc03690c4b867ff91d89681fcf872a93/pkg/fieldpath/paved.go#L135-L137
In this case, the lib provides an exported method to check for not found without the need for us to compare against the error's string. This way we also nicely decouple our logic from implementation details on
crossplane-runtime
.Fixes #193
I have: