fix: avoid sending template metadata update if max_port_share_level
is default
#190
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.
Closes #188.
For context, the
MaxPortShareLevel
template metadata value was not present on thecoderd
create template request prior to 2.15. As such, during template creation we need to send an update request for backwards compatibility (though we could probably remove this soon), see #110.Whilst we don't send this update request is the attribute is omitted on the resource, we were sending a spurious update request if the value was explicitly configured to the default value ('owner' for enterprise+, 'public' otherwise). This was causing the error in the linked issue. An example is seen in the newly added test.
The fix is to just not send that update request if the configured value is:
note: I'd recommend hiding the whitespace when reviewing the diff