ocket8888 commented on a change in pull request #5922:
URL: https://github.com/apache/trafficcontrol/pull/5922#discussion_r647786092
##########
File path: traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
##########
@@ -1070,87 +1189,88 @@ func updateV40(w http.ResponseWriter, r *http.Request,
inf *api.APIInfo, dsV40 *
if err != nil {
usrErr, sysErr, code := api.ParseDBError(err)
- return nil, code, usrErr, sysErr
+ return nil, alerts, code, usrErr, sysErr
}
defer resultRows.Close()
if !resultRows.Next() {
- return nil, http.StatusNotFound, errors.New("no delivery
service found with this id"), nil
+ return nil, alerts, http.StatusNotFound, errors.New("no
delivery service found with this id"), nil
}
- lastUpdated := tc.TimeNoMod{}
+ var lastUpdated time.Time
if err := resultRows.Scan(&lastUpdated); err != nil {
- return nil, http.StatusInternalServerError, nil,
errors.New("scan updating delivery service: " + err.Error())
+ return nil, alerts, http.StatusInternalServerError, nil,
errors.New("scan updating delivery service: " + err.Error())
}
if resultRows.Next() {
- xmlID := ""
- if ds.XMLID != nil {
- xmlID = *ds.XMLID
- }
- return nil, http.StatusInternalServerError, nil,
errors.New("updating delivery service " + xmlID + ": " + "this update affected
too many rows: > 1")
+ return nil, alerts, http.StatusInternalServerError, nil,
errors.New("updating delivery service " + ds.XMLID + ": " + "this update
affected too many rows: > 1")
}
if ds.ID == nil {
- return nil, http.StatusInternalServerError, nil,
errors.New("missing id after update")
+ return nil, alerts, http.StatusInternalServerError, nil,
errors.New("missing id after update")
}
- if ds.XMLID == nil {
- return nil, http.StatusInternalServerError, nil,
errors.New("missing xml_id after update")
- }
- if ds.TypeID == nil {
- return nil, http.StatusInternalServerError, nil,
errors.New("missing type after update")
- }
- if ds.RoutingName == nil {
- return nil, http.StatusInternalServerError, nil,
errors.New("missing routing name after update")
+
+ if inf.Version != nil && inf.Version.Major >= 4 {
Review comment:
The way changing the TLS versions works is it makes two database calls:
one to delete the old ones and another to insert the new ones (if any). So in
the situation where a DS with tls versions is being manipulated at APIv3, that
will add 3 more db calls, rather than a normal `int` or `string` field that
would result in just one.
If that's not a big deal I can change it, but that's why it is the way it is
right now
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]