* Fix target port handling
This fixes two issues that compounded on each other (see the Changelog
update for more information):
* The verification logic for hosts was not correct for update operations
(in multiple ways) which meant that a host could be updated after
creation to have a port. Targets had a previously fixed bug where they
did not require a default port, which meant that ports could be used
from hosts
* A recent (unreleased) change had prioritized any port coming from the
host over the default port, which would mean there was no way if a
host had a port specified to use it in multiple targets.
This fixes the update verification logic, and strikes a middle ground
between breaking things and not by allowing existing addresses with
ports to be used with targets but ignoring that port, instead requiring
targets to have default port set at authorize time (currently there is
backwards compat that does not require this due to the original optional
port bug).
* Update CHANGELOG.md
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
badFields["attributes.address"]=fmt.Sprintf("Address length must be between %d and %d characters.",static.MinHostAddressLength,static.MaxHostAddressLength)
badFields[globals.AttributesAddressField]=fmt.Sprintf("Address length must be between %d and %d characters.",static.MinHostAddressLength,static.MaxHostAddressLength)
badFields["attributes.address"]=fmt.Sprintf("Address length must be between %d and %d characters.",static.MinHostAddressLength,static.MaxHostAddressLength)
switch{
caseattrs==nil:
badFields[globals.AttributesField]="Attributes field not supplied in request"
badFields[globals.AttributesAddressField]=fmt.Sprintf("Address length must be between %d and %d characters.",static.MinHostAddressLength,static.MaxHostAddressLength)
// Verify it is a set updated after it was created
// TODO: This is currently failing.
assert.True(gotUpdateTime.After(hCreated),"Updated set should have been updated after it's creation. Was updated %v, which is after %v",gotUpdateTime,hCreated)
require.NotNilf(tc.res,"Expected UpdateHost response to be nil, but was %v",got)
// Verify it is a set updated after it was created
assert.True(gotUpdateTime.After(hCreated),"Updated set should have been updated after its creation. Was updated %v, which is after %v",gotUpdateTime,hCreated)
// Clear all values which are hard to compare against.
returnnil,errors.New(ctx,errors.InvalidParameter,op,fmt.Sprintf("neither the selected host %q nor the target provides a port to use",chosenEndpoint.HostId))