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

rob 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 50b0c2cc46 t3c log run mode and log update flag changes (#6991)
50b0c2cc46 is described below

commit 50b0c2cc460f2c0ae27357e968a135cc13a90399
Author: Joe Pappano <[email protected]>
AuthorDate: Fri Jul 29 18:03:40 2022 -0400

    t3c log run mode and log update flag changes (#6991)
    
    * print selected run mode for t3c-apply
    
    * print current value or to update/reval flag and what it was changed to 
and time it took to change
---
 cache-config/t3c-apply/config/config.go       |  1 +
 cache-config/t3c-apply/torequest/torequest.go | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/cache-config/t3c-apply/config/config.go 
b/cache-config/t3c-apply/config/config.go
index 05aa96a0ed..8d335630ac 100644
--- a/cache-config/t3c-apply/config/config.go
+++ b/cache-config/t3c-apply/config/config.go
@@ -313,6 +313,7 @@ If any of the related flags are also set, they override the 
mode's default behav
                if runMode == t3cutil.ModeInvalid {
                        return Cfg{}, errors.New(*runModePtr + " is an invalid 
mode.")
                }
+               modeLogStrs = append(modeLogStrs, "t3c-apply is running in 
"+runMode.String()+" mode")
                switch runMode {
                case t3cutil.ModeSyncDS:
                        // syncds flags are all the defaults, no need to change 
anything
diff --git a/cache-config/t3c-apply/torequest/torequest.go 
b/cache-config/t3c-apply/torequest/torequest.go
index 35cef6a396..996506e621 100644
--- a/cache-config/t3c-apply/torequest/torequest.go
+++ b/cache-config/t3c-apply/torequest/torequest.go
@@ -1146,6 +1146,12 @@ func (r *TrafficOpsReq) StartServices(syncdsUpdate 
*UpdateStatus, metaData *t3cu
        return nil
 }
 
+func (r *TrafficOpsReq) ShowUpdateStatus(flagType []string, start time.Time, 
curSetting, newSetting bool) {
+       for _, flag := range flagType {
+               log.Infof("%s flag currently set to %v, setting to %v took %v", 
flag, curSetting, newSetting, time.Since(start).Round(time.Millisecond))
+       }
+}
+
 func (r *TrafficOpsReq) UpdateTrafficOps(syncdsUpdate *UpdateStatus) error {
        var performUpdate bool
 
@@ -1178,17 +1184,25 @@ func (r *TrafficOpsReq) UpdateTrafficOps(syncdsUpdate 
*UpdateStatus) error {
 
        // TODO: The boolean flags/representation can be removed after ATC 
(v7.0+)
        if !r.Cfg.ReportOnly && !r.Cfg.NoUnsetUpdateFlag {
+               start := time.Now()
+               apply := []string{}
+               var b bool
                if r.Cfg.Files == t3cutil.ApplyFilesFlagAll {
-                       b := false
+                       b = false
+                       apply = append(apply, "update")
+                       log.Infof("Update flag currently set to %v, setting to 
%v", serverStatus.UpdatePending, b)
                        err = sendUpdate(r.Cfg, serverStatus.ConfigUpdateTime, 
nil, &b, nil)
                } else if r.Cfg.Files == t3cutil.ApplyFilesFlagReval {
-                       b := false
+                       b = false
+                       apply = append(apply, 
t3cutil.ApplyFilesFlagReval.String())
+                       log.Infof("Reval flag currently set to %v, setting to 
%v", serverStatus.RevalPending, b)
                        err = sendUpdate(r.Cfg, nil, 
serverStatus.RevalidateUpdateTime, nil, &b)
                }
                if err != nil {
                        return errors.New("Traffic Ops Update failed: " + 
err.Error())
                }
                log.Infoln("Traffic Ops has been updated.")
+               r.ShowUpdateStatus(apply, start, serverStatus.UpdatePending, b)
        }
        return nil
 }

Reply via email to