From 4470871f06d6074cc45ba92619fd8a417f398373 Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Wed, 6 Apr 2022 16:50:17 -0400 Subject: [PATCH 1/2] added func to write cookie to filesystem. --- cache-config/t3c-update/t3c-update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cache-config/t3c-update/t3c-update.go b/cache-config/t3c-update/t3c-update.go index 310a4f3db4..31f9884ef5 100644 --- a/cache-config/t3c-update/t3c-update.go +++ b/cache-config/t3c-update/t3c-update.go @@ -80,5 +80,5 @@ func main() { } else { log.Infoln("Update successfully completed") } - + cfg.TCCfg.TOClient.WriteFsCookie(toreq.FsCookiePath + cfg.TOUser + ".cookie") } From 7edb094e3407365205d7d37ba2ed54ee482a0213 Mon Sep 17 00:00:00 2001 From: jpappa200 Date: Wed, 6 Apr 2022 16:55:32 -0400 Subject: [PATCH 2/2] changed cookie file name to contain the TO username. --- cache-config/t3c-request/t3c-request.go | 2 +- cache-config/t3cutil/toreq/client.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cache-config/t3c-request/t3c-request.go b/cache-config/t3c-request/t3c-request.go index 821ee80cdc..4f94fc186c 100644 --- a/cache-config/t3c-request/t3c-request.go +++ b/cache-config/t3c-request/t3c-request.go @@ -68,5 +68,5 @@ func main() { os.Exit(3) } } - cfg.TCCfg.TOClient.WriteFsCookie(toreq.FsCookiePath) + cfg.TCCfg.TOClient.WriteFsCookie(toreq.FsCookiePath + cfg.TOUser + ".cookie") } diff --git a/cache-config/t3cutil/toreq/client.go b/cache-config/t3cutil/toreq/client.go index 289eddafac..5f5d97ddfb 100644 --- a/cache-config/t3cutil/toreq/client.go +++ b/cache-config/t3cutil/toreq/client.go @@ -68,14 +68,14 @@ func (cl *TOClient) SetURL(newURL string) { } } -const FsCookiePath = `/var/lib/trafficcontrol-cache-config/fsCookie` +const FsCookiePath = `/var/lib/trafficcontrol-cache-config/` // 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)) + "'") client := &TOClient{} - fsCookie, err := torequtil.GetFsCookie(FsCookiePath) + fsCookie, err := torequtil.GetFsCookie(FsCookiePath + user + ".cookie") if err != nil { log.Infoln("Error retrieving cookie: ", err) }