daemon: return an InvalidParameter error when ep settings are wrong

Since v25.0 (commit ff50388), we validate endpoint settings when
containers are created, instead of doing so when containers are started.
However, a container created prior to that release would still trigger
validation error at start-time. In such case, the API returns a 500
status code because the Go error isn't wrapped into an InvalidParameter
error. This is now fixed.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton 2024-01-22 12:47:42 +01:00
parent e5dbe10e65
commit fcc651972e
No known key found for this signature in database
GPG key ID: 630B8E1DCBDB1864

View file

@ -645,7 +645,7 @@ func (daemon *Daemon) updateNetworkConfig(container *container.Container, n *lib
}
if err := validateEndpointSettings(n, n.Name(), endpointConfig); err != nil {
return err
return errdefs.InvalidParameter(err)
}
if updateSettings {