You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/11/09 20:36:53 UTC
[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5260: Validate the assignment of ORG servers to topology-based DSes
rawlinp commented on a change in pull request #5260:
URL: https://github.com/apache/trafficcontrol/pull/5260#discussion_r520102413
##########
File path: traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
##########
@@ -857,47 +887,46 @@ SELECT
FROM
deliveryservice ds
JOIN type tp ON ds.type = tp.id
-WHERE
- ds.id = $1
`
- di := DSInfo{ID: id}
- if err := tx.QueryRow(qry, id).Scan(&di.Name, &di.Type, &di.EdgeHeaderRewrite, &di.MidHeaderRewrite, &di.RegexRemap, &di.SigningAlgorithm, &di.CacheURL, &di.MaxOriginConnections, &di.Topology, &di.CDNID); err != nil {
+
+func scanDSInfoRow(row *sql.Row) (DSInfo, bool, error) {
+ di := DSInfo{}
+ if err := row.Scan(
+ &di.ID,
+ &di.Name,
+ &di.Type,
+ &di.EdgeHeaderRewrite,
+ &di.MidHeaderRewrite,
+ &di.RegexRemap,
+ &di.SigningAlgorithm,
+ &di.CacheURL,
+ &di.MaxOriginConnections,
+ &di.Topology,
+ &di.CDNID,
+ ); err != nil {
if err == sql.ErrNoRows {
return DSInfo{}, false, nil
}
- return DSInfo{}, false, fmt.Errorf("querying delivery service server ds info '%v': %v", id, err)
+ return DSInfo{}, false, fmt.Errorf("querying delivery service server ds info: %v", err)
Review comment:
I think because if the scan failed, we probably don't have the ID or the xmlID. I will add the ID/XMLID to the callers.
##########
File path: traffic_ops/traffic_ops_golang/server/servers_assignment.go
##########
@@ -112,6 +112,12 @@ func AssignDeliveryServicesToServerHandler(w http.ResponseWriter, r *http.Reques
api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
return
}
+ if strings.HasPrefix(serverInfo.Type, tc.OriginTypeName) {
Review comment:
That's confusing to me because an `ORG`-type server is not a cache.
----------------------------------------------------------------
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:
users@infra.apache.org