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 563e62c46d Fix t3c fallback around update time compat (#6866)
563e62c46d is described below

commit 563e62c46d4b6dcc73c98a9e39a931ecbf51e628
Author: Robert O Butts <[email protected]>
AuthorDate: Wed Jun 1 12:05:22 2022 -0600

    Fix t3c fallback around update time compat (#6866)
---
 cache-config/t3cutil/toreq/clientfuncs.go | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/cache-config/t3cutil/toreq/clientfuncs.go 
b/cache-config/t3cutil/toreq/clientfuncs.go
index 54ea949607..9c5e335ce5 100644
--- a/cache-config/t3cutil/toreq/clientfuncs.go
+++ b/cache-config/t3cutil/toreq/clientfuncs.go
@@ -774,18 +774,18 @@ func (cl *TOClient) SetServerUpdateStatus(cacheHostName 
tc.CacheName, configAppl
 
 // SetServerUpdateStatusBoolCompat sets the server's update and reval statuses 
in Traffic Ops.
 // *** Compatability requirement until ATC (v7.0+) is deployed with the 
timestamp features
-func (cl *TOClient) SetServerUpdateStatusBoolCompat(cacheHostName 
tc.CacheName, configApply, revalApply *time.Time, configApplyBool, 
revalApplyBool *bool) (toclientlib.ReqInf, error) {
+func (cl *TOClient) SetServerUpdateStatusBoolCompat(cacheHostName 
tc.CacheName, configApply *time.Time, revalApply *time.Time, configApplyBool 
*bool, revalApplyBool *bool) (toclientlib.ReqInf, error) {
        if cl.c == nil {
-               var updateStatus, revalStatus *bool
-               if configApply != nil || configApplyBool != nil {
-                       *updateStatus = true
-                       revalStatus = nil
+               if configApply != nil && configApplyBool == nil {
+                       return toclientlib.ReqInf{}, errors.New("Traffic Ops 
older version doesn't support timestamps, but update boolean was nil and 
timestamp wasn't! Booleans must be passed to work with older Traffic Ops!")
                }
-               if revalApply != nil || revalApplyBool != nil {
-                       *revalStatus = true
-                       updateStatus = nil
+               if revalApply != nil && revalApplyBool == nil {
+                       return toclientlib.ReqInf{}, errors.New("Traffic Ops 
older version doesn't support timestamps, but reval boolean was nil and 
timestamp wasn't! Booleans must be passed to work with older Traffic Ops!")
                }
-               return cl.old.SetServerUpdateStatus(cacheHostName, 
updateStatus, revalStatus)
+               if configApplyBool == nil && revalApplyBool == nil {
+                       return toclientlib.ReqInf{}, errors.New("Traffic Ops 
older version doesn't support timestamps, but both booleans were nil! Booleans 
must be passed to work with older Traffic Ops!")
+               }
+               return cl.old.SetServerUpdateStatus(cacheHostName, 
configApplyBool, revalApplyBool)
        }
 
        reqInf := toclientlib.ReqInf{}

Reply via email to