rob05c commented on a change in pull request #4044: Ensure server_capability 
can only be assigned to edges or mids
URL: https://github.com/apache/trafficcontrol/pull/4044#discussion_r341202275
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/server/servers_server_capability.go
 ##########
 @@ -165,3 +186,15 @@ server) VALUES (
 :server_capability,
 :server) RETURNING server, server_capability, last_updated`
 }
+
+func scCheckServerTypeQuery() string {
+       return `
+SELECT EXISTS (
+       SELECT s.id
+       FROM server s
+       JOIN type t ON s.type = t.id
+       WHERE s.id = $1
+       AND t.use_in_table = 'server'
+       AND (t.name LIKE '%MID%' OR t.name LIKE '%EDGE%')
 
 Review comment:
   I agree with @mitchell852, AFAIK most or all existing things check for the 
prefix. 
   
   Checking anywhere would make this strictly more lenient than most other 
checks, which sounds nice, but if someone relies on it, then stuff elsewhere 
might not work that they don't expect.
   
   Better to require a prefix everywhere I think.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to