Skip to content

Commit

Permalink
Fix t3c update when fallback occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
rob05c committed Sep 7, 2021
1 parent 9cddb11 commit df2e0b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 5 additions & 0 deletions cache-config/t3cutil/toreq/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cache-config/t3cutil/toreq/toreqold/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)) + "'")
Expand Down
2 changes: 1 addition & 1 deletion cache-config/t3cutil/toreq/toreqold/clientfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit df2e0b3

Please sign in to comment.