This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 14b1c61673 Fix IMS error: Couldn't get the max last updated time 
(#6912)
14b1c61673 is described below

commit 14b1c61673ce9f5bf951adcfac10434934790605
Author: Eric Holguin <[email protected]>
AuthorDate: Tue Jul 5 10:01:31 2022 -0600

    Fix IMS error: Couldn't get the max last updated time (#6912)
    
    * add check for cdn query parameter
    
    * update changelog
---
 CHANGELOG.md                                                 |  1 +
 .../traffic_ops_golang/deliveryservice/servers/servers.go    | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3834cb1efd..4ddbbd227f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,6 +63,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#6896](https://github.com/apache/trafficcontrol/issues/6896) Fixed the 
`POST api/cachegroups/id/queue_updates` endpoint so that it doesn't give an 
internal server error anymore.
 - [#6933](https://github.com/apache/trafficcontrol/issues/6933) Fixed 
tc-health-client to handle credentials files with special characters in 
variables
 - [#6776](https://github.com/apache/trafficcontrol/issues/6776) User 
properties only required sometimes
+- Fixed TO API `GET /deliveryservicesserver` causing error when an IMS request 
is made with the `cdn` and `maxRevalDurationDays` parameters set.
 
 ### Removed
 - Remove `client.steering.forced.diversity` feature flag(profile parameter) 
from Traffic Router (TR). Client steering responses now have cache diversity by 
default.
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go 
b/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
index 2e67f33e66..39a5f0dfc1 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/servers/servers.go
@@ -208,16 +208,20 @@ func (dss *TODeliveryServiceServer) readDSS(h 
http.Header, tx *sqlx.Tx, user *au
        }
        dss.ServerIDs = serverIDs
        dss.DeliveryServiceIDs = dsIDs
-       cdn := params["cdn"]
+
+       queryValues := map[string]interface{}{}
+       cdn := ""
+       if cdnName, ok := params["cdn"]; ok {
+               cdn = cdnName
+               queryValues["cdn"] = cdnName
+       }
        dss.CDN = cdn
        query1, err := selectQuery(orderby, strconv.Itoa(limit), 
strconv.Itoa(offset), dsIDs, serverIDs, true, cdn)
        if err != nil {
                log.Warnf("Error getting the max last updated query %v", err)
        }
        if useIMS {
-               queryValues := map[string]interface{}{
-                       "accessibleTenants": pq.Array(tenantIDs),
-               }
+               queryValues["accessibleTenants"] = pq.Array(tenantIDs)
                runSecond, maxTime = ims.TryIfModifiedSinceQuery(tx, h, 
queryValues, query1)
                if !runSecond {
                        log.Debugln("IMS HIT")

Reply via email to