You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2022/11/04 16:18:49 UTC

[trafficcontrol] branch master updated: Fix t3c multiple profile generation (#7163)

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

ocket8888 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 67a5641689 Fix t3c multiple profile generation (#7163)
67a5641689 is described below

commit 67a5641689d38e5dc76c79e317e6b25bc4a46145
Author: Robert O Butts <ro...@users.noreply.github.com>
AuthorDate: Fri Nov 4 10:18:42 2022 -0600

    Fix t3c multiple profile generation (#7163)
    
    Fixes a t3c bug resulting in only params from the last profile when
    multiple profiles are assigned.
    
    The bug was a go for loop overwriting the loop variable which was
    stored, required a copy of the iteration variable.
---
 CHANGELOG.md                       | 1 +
 cache-config/t3cutil/getdatacfg.go | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index dac0eb3081..1940576bf7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#7021](https://github.com/apache/trafficcontrol/issues/7021) *Cache Config* Fixed cache config for Delivery Services with IP Origins.
 - [#7043](https://github.com/apache/trafficcontrol/issues/7043) Fixed cache config missing retry parameters for non-topology MSO Delivery Services going direct from edge to origin.
 - [#7047](https://github.com/apache/trafficcontrol/issues/7047) *Traffic Ops* allow `apply_time` query parameters on the `servers/{id-name}/update` when the CDN is locked.
+- [#7163](https://github.com/apache/trafficcontrol/issues/7163) Fix cache config for multiple profiles
 - [#7048](https://github.com/apache/trafficcontrol/issues/7048) *Traffic Stats* Add configuration value to set the client request timeout for calls to Traffic Ops.
 - Updated Apache Tomcat from 9.0.43 to 9.0.67
 - [#7125](https://github.com/apache/trafficcontrol/issues/7125) *Docs* Reflect implementation and deprecation notice for `letsencrypt/autorenew` endpoint.
diff --git a/cache-config/t3cutil/getdatacfg.go b/cache-config/t3cutil/getdatacfg.go
index 33d680bc06..4cddbf17bf 100644
--- a/cache-config/t3cutil/getdatacfg.go
+++ b/cache-config/t3cutil/getdatacfg.go
@@ -517,7 +517,8 @@ func GetConfigData(toClient *toreq.TOClient, disableProxy bool, cacheHostName st
 			return nil
 		}
 		serverParamsFs := []func() error{}
-		for _, profileName := range server.ProfileNames {
+		for _, profileNamePtr := range server.ProfileNames {
+			profileName := profileNamePtr // must copy, because Go for-loops overwrite the variable every iteration
 			serverParamsFs = append(serverParamsFs, func() error { return serverParamsF(atscfg.ProfileName(profileName)) })
 		}