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 2022/10/25 19:03:51 UTC

[GitHub] [trafficcontrol] ocket8888 opened a new pull request, #7156: Fix APIv4.0 returning APIv4.1 DS structures

ocket8888 opened a new pull request, #7156:
URL: https://github.com/apache/trafficcontrol/pull/7156

   This PR fixes a bug introduced by #7111 where APIv4.0 responses containing representations of Delivery Services used the representation from APIv4.1.
   
   <hr/>
   
   ## Which Traffic Control components are affected by this PR?
   - Traffic Ops
   
   ## What is the best way to verify this PR?
   Make sure all the tests still pass, request Delivery Services at APIv4.0 and observe no `regional` property, then again at APIv4.1 and observe that it now *does* have the v4.1 `regional` property.
   
   ## If this is a bugfix, which Traffic Control versions contained the bug?
   - master
   
   ## PR submission checklist
   - [x] This PR utilizes existing tests
   - [x] This PR needs no documentation because the bug was never released and documentation matches the intended behavior, not the bugged behavior
   - [x] This PR needs no CHANGELOG.md entry because the bug was never released
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY**


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] zrhoffman merged pull request #7156: Fix APIv4.0 returning APIv4.1 DS structures

Posted by GitBox <gi...@apache.org>.
zrhoffman merged PR #7156:
URL: https://github.com/apache/trafficcontrol/pull/7156


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7156: Fix APIv4.0 returning APIv4.1 DS structures

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7156:
URL: https://github.com/apache/trafficcontrol/pull/7156#discussion_r1004982343


##########
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go:
##########
@@ -614,7 +614,7 @@ func (ds *TODeliveryService) Read(h http.Header, useIMS bool) ([]interface{}, er
 	for _, ds := range dses {
 		switch {
 		// NOTE: it's required to handle minor version cases in a descending >= manner
-		case version.Major >= 4 && version.Minor >= 1:
+		case version.Major > 4 || (version.Major == 4 && version.Minor >= 1):

Review Comment:
   This is fine, though `Version.GreaterThanOrEqualTo()` can be used now, too
   
   https://github.com/apache/trafficcontrol/blob/6c532922e706481cb944820b8fa6af20cc3d11ee/traffic_ops/traffic_ops_golang/cdn/cdns.go#L67



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] ocket8888 commented on a diff in pull request #7156: Fix APIv4.0 returning APIv4.1 DS structures

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on code in PR #7156:
URL: https://github.com/apache/trafficcontrol/pull/7156#discussion_r1005050496


##########
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go:
##########
@@ -614,7 +614,7 @@ func (ds *TODeliveryService) Read(h http.Header, useIMS bool) ([]interface{}, er
 	for _, ds := range dses {
 		switch {
 		// NOTE: it's required to handle minor version cases in a descending >= manner
-		case version.Major >= 4 && version.Minor >= 1:
+		case version.Major > 4 || (version.Major == 4 && version.Minor >= 1):

Review Comment:
   Noted; though I don't want to mess with that any more; I need to rebase the DS Active flag changes every time it changes.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7156: Fix APIv4.0 returning APIv4.1 DS structures

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7156:
URL: https://github.com/apache/trafficcontrol/pull/7156#discussion_r1004876267


##########
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go:
##########
@@ -572,8 +614,10 @@ func (ds *TODeliveryService) Read(h http.Header, useIMS bool) ([]interface{}, er
 	for _, ds := range dses {
 		switch {
 		// NOTE: it's required to handle minor version cases in a descending >= manner
-		case version.Major > 3:
+		case version.Major >= 4 && version.Minor >= 1:
 			returnable = append(returnable, ds.RemoveLD1AndLD2())
+		case version.Major >= 4:
+			returnable = append(returnable, ds.DeliveryServiceV40.RemoveLD1AndLD2())

Review Comment:
   The API 4.0 case matched for API 5.0



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org