Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix t3c update when fallback occurs #6169

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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