Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
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
23 changes: 15 additions & 8 deletions traffic_ops_ort/t3c/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
)

var TSHome string = "/opt/trafficserver"
var TSConfigDir string = "/opt/trafficserver/etc/trafficserver"

const (
StatusDir = "/opt/ort/status"
Expand Down Expand Up @@ -248,25 +249,31 @@ func GetCfg() (Cfg, error) {
if *toPassPtr == "" {
toPass = os.Getenv("TO_PASS")
}

// set TSHome
var tsHome = ""
if *tsHomePtr != "" {
TSHome = *tsHomePtr
fmt.Printf("\nset TSHome from command line: '%s'\n\n", TSHome)
tsHome = *tsHomePtr
fmt.Printf("set TSHome from command line: '%s'\n\n", TSHome)
}
if *tsHomePtr == "" {
tsHome := os.Getenv("TS_HOME") // check for the environment variable.
if *tsHomePtr == "" { // evironment or rpm check.
tsHome = os.Getenv("TS_HOME") // check for the environment variable.
if tsHome != "" {
fmt.Printf("\nset TSHome from TS_HOME environment variable '%s'\n\n", TSHome)
fmt.Printf("set TSHome from TS_HOME environment variable '%s'\n", TSHome)
} else { // finally check using the config file listing from the rpm package.
tsHome = GetTSPackageHome()
if tsHome != "" {
TSHome = tsHome
fmt.Printf("\nset TSHome from the RPM config file list '%s'\n\n", TSHome)
fmt.Printf("set TSHome from the RPM config file list '%s'\n", tsHome)
} else {
fmt.Printf("\nno override for TSHome was found, using the configured default: '%s'\n\n", TSHome)
fmt.Printf("no override for TSHome was found, using the configured default: '%s'\n", TSHome)
}
}
}
if tsHome != "" {
TSHome = tsHome
TSConfigDir = tsHome + "/etc/trafficserver"
fmt.Printf("TSHome: %s, TSConfigDir: %s\n", TSHome, TSConfigDir)
}

usageStr := "basic usage: t3c --traffic-ops-url=myurl --traffic-ops-user=myuser --traffic-ops-password=mypass --cache-host-name=my-cache"
if strings.TrimSpace(toURL) == "" {
Expand Down
14 changes: 6 additions & 8 deletions traffic_ops_ort/t3c/t3c.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ func main() {
}
}

log.Debugf("Preparing to fetch the config files for %s, cfg.RunMode: %s, syncdsUpdate: %s\n", cfg.CacheHostName, cfg.RunMode, syncdsUpdate)

err = trops.GetConfigFileList()
if err != nil {
log.Errorf("Unable to continue: %s\n", err)
os.Exit(ConfigFilesError)
}

if cfg.RunMode == config.Revalidate {
log.Infoln("======== Revalidating, no package processing needed ========")
} else {
Expand All @@ -139,6 +131,12 @@ func main() {
}
}

log.Debugf("Preparing to fetch the config files for %s, cfg.RunMode: %s, syncdsUpdate: %s\n", cfg.CacheHostName, cfg.RunMode, syncdsUpdate)
err = trops.GetConfigFileList()
if err != nil {
log.Errorf("Unable to continue: %s\n", err)
os.Exit(ConfigFilesError)
}
syncdsUpdate, err = trops.ProcessConfigFiles()
if err != nil {
log.Errorf("Error while processing config files: %s\n", err.Error())
Expand Down
1 change: 1 addition & 0 deletions traffic_ops_ort/t3c/torequest/torequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (r *TrafficOpsReq) atsTcExecCommand(cmdstr string, queueState int, revalSta
}

args := []string{
"--dir=" + config.TSConfigDir,
"--traffic-ops-timeout-milliseconds=" + strconv.FormatInt(int64(r.Cfg.TOTimeoutMS), 10),
"--traffic-ops-disable-proxy=" + strconv.FormatBool(r.Cfg.ReverseProxyDisable),
"--traffic-ops-user=" + r.Cfg.TOUser,
Expand Down