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

zrhoffman 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 96afe89  Fix t3c update when fallback occurs (#6169)
96afe89 is described below

commit 96afe89c763d10b017e48e5733dc10f041f32411
Author: Robert O Butts <[email protected]>
AuthorDate: Tue Sep 7 15:04:08 2021 -0600

    Fix t3c update when fallback occurs (#6169)
---
 CHANGELOG.md                                       | 1 +
 cache-config/t3cutil/toreq/client.go               | 5 +++++
 cache-config/t3cutil/toreq/toreqold/client.go      | 4 ++++
 cache-config/t3cutil/toreq/toreqold/clientfuncs.go | 2 +-
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53321c5..6d79610 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -104,6 +104,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#6027](https://github.com/apache/trafficcontrol/issues/6027) - Collapsed DB 
migrations
 - [#6091](https://github.com/apache/trafficcontrol/issues/6091) - Fixed cache 
config of internal cache communication for https origins
 - [#6066](https://github.com/apache/trafficcontrol/issues/6066) - Fixed 
missing/incorrect indices on some tables
+- [#6169](https://github.com/apache/trafficcontrol/issues/6169) - Fixed 
t3c-update not updating server status when a fallback to a previous Traffic Ops 
API version occurred
 - [#5576](https://github.com/apache/trafficcontrol/issues/5576) - Inconsistent 
Profile Name restrictions
 - Fixed Federations IMS so TR federations watcher will get updates.
 
diff --git a/cache-config/t3cutil/toreq/client.go 
b/cache-config/t3cutil/toreq/client.go
index b73844c..0f21b16 100644
--- a/cache-config/t3cutil/toreq/client.go
+++ b/cache-config/t3cutil/toreq/client.go
@@ -104,6 +104,11 @@ func New(url *url.URL, user string, pass string, insecure 
bool, timeout time.Dur
                }
                client.c = nil
                client.old = oldClient
+
+               {
+                       newClient := toclient.NewNoAuthSession("", false, "", 
false, 0) // only used for the version, because toClient could be nil if it had 
an error
+                       log.Infof("cache-config Traffic Ops client: %v not 
supported, falling back to %v\n", newClient.APIVersion(), 
oldClient.APIVersion())
+               }
        }
 
        return client, nil
diff --git a/cache-config/t3cutil/toreq/toreqold/client.go 
b/cache-config/t3cutil/toreq/toreqold/client.go
index 98d17c2..5b716fc 100644
--- a/cache-config/t3cutil/toreq/toreqold/client.go
+++ b/cache-config/t3cutil/toreq/toreqold/client.go
@@ -49,6 +49,10 @@ func (cl *TOClient) SetURL(newURL string) {
        cl.c.URL = newURL
 }
 
+func (cl *TOClient) APIVersion() string {
+       return cl.c.APIVersion()
+}
+
 // New logs into Traffic Ops, returning the TOClient which contains the 
logged-in client.
 func New(url *url.URL, user string, pass string, insecure bool, timeout 
time.Duration, userAgent string) (*TOClient, error) {
        log.Infoln("URL: '" + url.String() + "' User: '" + user + "' Pass len: 
'" + strconv.Itoa(len(pass)) + "'")
diff --git a/cache-config/t3cutil/toreq/toreqold/clientfuncs.go 
b/cache-config/t3cutil/toreq/toreqold/clientfuncs.go
index b65d46c..1395238 100644
--- a/cache-config/t3cutil/toreq/toreqold/clientfuncs.go
+++ b/cache-config/t3cutil/toreq/toreqold/clientfuncs.go
@@ -570,7 +570,7 @@ func (cl *TOClient) GetServerUpdateStatus(cacheHostName 
tc.CacheName) (tc.Server
 func (cl *TOClient) SetServerUpdateStatus(cacheHostName tc.CacheName, 
updateStatus *bool, revalStatus *bool) (toclientlib.ReqInf, error) {
        reqInf := toclientlib.ReqInf{}
        err := torequtil.GetRetry(cl.NumRetries, 
"server_update_status_"+string(cacheHostName), nil, func(obj interface{}) error 
{
-               _, toReqInf, err := 
cl.c.GetServerUpdateStatus(string(cacheHostName))
+               toReqInf, err := 
cl.c.SetUpdateServerStatuses(string(cacheHostName), updateStatus, revalStatus)
                if err != nil {
                        return errors.New("setting server update status from 
Traffic Ops '" + torequtil.MaybeIPStr(reqInf.RemoteAddr) + "': " + err.Error())
                }

Reply via email to