ocket8888 commented on a change in pull request #4916:
URL: https://github.com/apache/trafficcontrol/pull/4916#discussion_r466744260



##########
File path: traffic_monitor/manager/opsconfig.go
##########
@@ -169,42 +164,26 @@ func StartOpsConfigManager(
                        backoff = 
util.NewConstantBackoff(util.ConstantBackoffDuration)
                }
                for {
-                       realToSession, toAddr, err = 
to.LoginWithAgent(newOpsConfig.Url, newOpsConfig.Username, 
newOpsConfig.Password, newOpsConfig.Insecure, staticAppData.UserAgent, 
useCache, trafficOpsRequestTimeout)
+                       err = toSession.Update(newOpsConfig.Url, 
newOpsConfig.Username, newOpsConfig.Password, newOpsConfig.Insecure, 
staticAppData.UserAgent, useCache, trafficOpsRequestTimeout)
                        if err != nil {
                                handleErr(fmt.Errorf("MonitorConfigPoller: 
error instantiating Session with traffic_ops (%v): %s\n", toAddr, err))
                                duration := backoff.BackoffDuration()
                                log.Errorf("retrying in %v\n", duration)
                                time.Sleep(duration)
 
                                if toSession.BackupFileExists() && 
(toLoginCount >= cfg.TrafficOpsDiskRetryMax) {
-                                       jar, err := cookiejar.New(nil)
-                                       if err != nil {
-                                               log.Errorf("Err getting 
cookiejar")
-                                               continue
-                                       }
-
-                                       realToSession = 
to.NewSession(newOpsConfig.Username, newOpsConfig.Password, newOpsConfig.Url, 
staticAppData.UserAgent, &http.Client{
-                                               Timeout: 
trafficOpsRequestTimeout,
-                                               Transport: &http.Transport{
-                                                       TLSClientConfig: 
&tls.Config{InsecureSkipVerify: true},
-                                               },
-                                               Jar: jar,
-                                       }, useCache)
-                                       toSession.Set(realToSession)
-                                       // At this point we have a valid 
'dummy' session. This will allow us to pull from disk but will also retry when 
TO comes up

Review comment:
       Yeah, that's unavoidable, since we don't have a way to request which API 
versions TO supports. There was a proposal for that, but it never really got 
off the ground.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to