diff --git a/cache-config/t3c-apply/README.md b/cache-config/t3c-apply/README.md index 148fe7d301..33c39e4735 100644 --- a/cache-config/t3c-apply/README.md +++ b/cache-config/t3c-apply/README.md @@ -50,146 +50,138 @@ Typical usage is to install t3c on the cache machine, and then run it periodical # OPTIONS --2, --default-client-enable-h2 +-2, -\-default-client-enable-h2 Whether to enable HTTP/2 on Delivery Services by default, if they have no explicit Parameter. This is irrelevant if ATS records.config is not serving H2. If omitted, H2 is disabled. --b, --dns-local-bind +-b, -\-dns-local-bind [true | false] whether to use the server's Service Addresses to set the ATS DNS local bind address --c, --disable-parent-config-comments +-c, -\-disable-parent-config-comments Whether to disable verbose parent.config comments. Default false. --D, --dispersion=value +-D, -\-dispersion=value [seconds] wait a random number of seconds between 0 and [seconds] before starting, default 300 [300] --d, --log-location-debug=value - - Where to log debugs. May be a file path, stdout, stderr, or - null, default '' - --e, --log-location-error=value - - Where to log errors. May be a file path, stdout, stderr, or - null, default stderr [stderr] - --g, --git=value +-g, -\-git=value Create and use a git repo in the config directory. Options are yes, no, and auto. If yes, create and use. If auto, use if it exist. Default is auto. [auto] --H, --cache-host-name=value +-H, -\-cache-host-name=value Host name of the cache to generate config for. Must be the server host name in Traffic Ops, not a URL, and not the FQDN --h, --help +-h, -\-help Print usage information and exit --i, --log-location-info=value - - Where to log info. May be a file path, stdout, stderr, or - null, default stderr [stderr] - --I, --traffic-ops-insecure +-I, -\-traffic-ops-insecure [true | false] ignore certificate errors from Traffic Ops --l, --login-dispersion=value +-l, -\-login-dispersion=value [seconds] wait a random number of seconds between 0 and [seconds] before login to traffic ops, default 0 --M, --maxmind-location=value +-M, -\-maxmind-location=value URL of a maxmind gzipped database file, to be installed into the trafficserver etc directory. --m, --run-mode=value +-m, -\-run-mode=value [badass | report | revalidate | syncds] run mode, default is 'report' [report] --p, --reverse-proxy-disable +-o, -\-omit-via-string-release + + Whether to set the records.config via header to the ATS + release from the RPM. Default true. + +-O, -\-skip-os-check + + [false | true] skip os check, default is false + +-p, -\-reverse-proxy-disable [false | true] bypass the reverse proxy even if one has been configured default is false --P, --traffic-ops-password=value +-P, -\-traffic-ops-password=value Traffic Ops password. Required. May also be set with the environment variable TO_PASS --r, --num-retries=value +-r, -\-num-retries=value [number] retry connection to Traffic Ops URL [number] times, default is 3 [3] --R, --trafficserver-home=value +-R, -\-trafficserver-home=value Trafficserver Package directory. May also be set with the environment variable TS_HOME --s, --skip-os-check +-s, -\-silent - [false | true] skip os check, default is false + Silent. Errors are not logged, and the 'verbose' flag is + ignored. If a fatal error occurs, the return code will be + non-zero but no text will be output to stderr --S, --syncds-updates-ipallow +-S, -\-syncds-updates-ipallow Whether syncds mode will update ipallow. This exists because ATS had a bug where reloading after changing ipallow would block everything. Default is false. --T, --reval-wait-time=value +-T, -\-reval-wait-time=value [seconds] wait a random number of seconds between 0 and [seconds] before revlidation, default is 60 [60] --t, --traffic-ops-timeout-milliseconds=value +-t, -\-traffic-ops-timeout-milliseconds=value Timeout in milli-seconds for Traffic Ops requests, default is 30000 [30000] --u, --traffic-ops-url=value +-u, -\-traffic-ops-url=value Traffic Ops URL. Must be the full URL, including the scheme. Required. May also be set with the environment variable TO_URL --U, --traffic-ops-user=value +-U, -\-traffic-ops-user=value Traffic Ops username. Required. May also be set with the environment variable TO_USER --V, --default-client-tls-versions=value +-V, -\-default-client-tls-versions=value Comma-delimited list of default TLS versions for Delivery Services with no Parameter, e.g. - --default-tls-versions='1.1,1.2,1.3'. If omitted, all + -\-default-tls-versions='1.1,1.2,1.3'. If omitted, all versions are enabled. --v, --omit-via-string-release - - Whether to set the records.config via header to the ATS - release from the RPM. Default true. - --w, --log-location-warning=value +-v, -\-verbose - Where to log warnings. May be a file path, stdout, stderr, - or null, default stderr [stderr] + Log verbosity. Logging is output to stderr. By default, + errors are logged. To log warnings, pass '-v'. To log info, + pass '-vv'. To omit error logging, see '-s'. --W, --wait-for-parents +-W, -\-wait-for-parents [true | false | reval] do not update if parent_pending = 1 in the update json. Default is 'reval', wait for parents in revalidate diff --git a/cache-config/t3c-apply/config/config.go b/cache-config/t3c-apply/config/config.go index 20dce0200b..f4a7d6ee8a 100644 --- a/cache-config/t3c-apply/config/config.go +++ b/cache-config/t3c-apply/config/config.go @@ -211,16 +211,12 @@ func GetCfg() (Cfg, error) { dispersionPtr := getopt.IntLong("dispersion", 'D', 300, "[seconds] wait a random number of seconds between 0 and [seconds] before starting, default 300") loginDispersionPtr := getopt.IntLong("login-dispersion", 'l', 0, "[seconds] wait a random number of seconds between 0 and [seconds] before login to traffic ops, default 0") - logLocationDebugPtr := getopt.StringLong("log-location-debug", 'd', "", "Where to log debugs. May be a file path, stdout, stderr, or null, default ''") - logLocationErrorPtr := getopt.StringLong("log-location-error", 'e', "stderr", "Where to log errors. May be a file path, stdout, stderr, or null, default stderr") - logLocationInfoPtr := getopt.StringLong("log-location-info", 'i', "stderr", "Where to log info. May be a file path, stdout, stderr, or null, default stderr") - logLocationWarnPtr := getopt.StringLong("log-location-warning", 'w', "stderr", "Where to log warnings. May be a file path, stdout, stderr, or null, default stderr") cacheHostNamePtr := getopt.StringLong("cache-host-name", 'H', "", "Host name of the cache to generate config for. Must be the server host name in Traffic Ops, not a URL, and not the FQDN") retriesPtr := getopt.IntLong("num-retries", 'r', 3, "[number] retry connection to Traffic Ops URL [number] times, default is 3") revalWaitTimePtr := getopt.IntLong("reval-wait-time", 'T', 60, "[seconds] wait a random number of seconds between 0 and [seconds] before revlidation, default is 60") reverseProxyDisablePtr := getopt.BoolLong("reverse-proxy-disable", 'p', "[false | true] bypass the reverse proxy even if one has been configured default is false") runModePtr := getopt.StringLong("run-mode", 'm', "report", "[badass | report | revalidate | syncds] run mode, default is 'report'") - skipOSCheckPtr := getopt.BoolLong("skip-os-check", 's', "[false | true] skip os check, default is false") + skipOSCheckPtr := getopt.BoolLong("skip-os-check", 'O', "[false | true] skip os check, default is false") toInsecurePtr := getopt.BoolLong("traffic-ops-insecure", 'I', "[true | false] ignore certificate errors from Traffic Ops") toTimeoutMSPtr := getopt.IntLong("traffic-ops-timeout-milliseconds", 't', 30000, "Timeout in milli-seconds for Traffic Ops requests, default is 30000") toURLPtr := getopt.StringLong("traffic-ops-url", 'u', "", "Traffic Ops URL. Must be the full URL, including the scheme. Required. May also be set with the environment variable TO_URL") @@ -232,20 +228,38 @@ func GetCfg() (Cfg, error) { helpPtr := getopt.BoolLong("help", 'h', "Print usage information and exit") useGitStr := getopt.StringLong("git", 'g', "auto", "Create and use a git repo in the config directory. Options are yes, no, and auto. If yes, create and use. If auto, use if it exist. Default is auto.") syncdsUpdatesIPAllowPtr := getopt.BoolLong("syncds-updates-ipallow", 'S', "Whether syncds mode will update ipallow. This exists because ATS had a bug where reloading after changing ipallow would block everything. Default is false.") - omitViaStringReleasePtr := getopt.BoolLong("omit-via-string-release", 'v', "Whether to set the records.config via header to the ATS release from the RPM. Default true.") + omitViaStringReleasePtr := getopt.BoolLong("omit-via-string-release", 'o', "Whether to set the records.config via header to the ATS release from the RPM. Default true.") disableParentConfigCommentsPtr := getopt.BoolLong("disable-parent-config-comments", 'c', "Whether to disable verbose parent.config comments. Default false.") defaultEnableH2 := getopt.BoolLong("default-client-enable-h2", '2', "Whether to enable HTTP/2 on Delivery Services by default, if they have no explicit Parameter. This is irrelevant if ATS records.config is not serving H2. If omitted, H2 is disabled.") defaultClientTLSVersions := getopt.StringLong("default-client-tls-versions", 'V', "", "Comma-delimited list of default TLS versions for Delivery Services with no Parameter, e.g. --default-tls-versions='1.1,1.2,1.3'. If omitted, all versions are enabled.") maxmindLocationPtr := getopt.StringLong("maxmind-location", 'M', "", "URL of a maxmind gzipped database file, to be installed into the trafficserver etc directory.") + verbosePtr := getopt.CounterLong("verbose", 'v', `Log verbosity. Logging is output to stderr. By default, errors are logged. To log warnings, pass '-v'. To log info, pass '-vv'. To omit error logging, see '-s'`) + silentPtr := getopt.BoolLong("silent", 's', `Silent. Errors are not logged, and the 'verbose' flag is ignored. If a fatal error occurs, the return code will be non-zero but no text will be output to stderr`) getopt.Parse() dispersion := time.Second * time.Duration(*dispersionPtr) loginDispersion := time.Second * time.Duration(*loginDispersionPtr) - logLocationDebug := *logLocationDebugPtr - logLocationError := *logLocationErrorPtr - logLocationInfo := *logLocationInfoPtr - logLocationWarn := *logLocationWarnPtr + + logLocationError := log.LogLocationStderr + logLocationWarn := log.LogLocationNull + logLocationInfo := log.LogLocationNull + logLocationDebug := log.LogLocationNull + if *silentPtr { + logLocationError = log.LogLocationNull + } else { + if *verbosePtr >= 1 { + logLocationWarn = log.LogLocationStderr + } + if *verbosePtr >= 2 { + logLocationInfo = log.LogLocationStderr + logLocationDebug = log.LogLocationStderr // t3c only has 3 verbosity options: none (-s), error (default or --verbose=0), warning (-v), and info (-vv). Any code calling log.Debug is treated as Info. + } + } + + if *verbosePtr > 2 { + return Cfg{}, errors.New("Too many verbose options. The maximum log verbosity level is 2 (-vv or --verbose=2) for errors (0), warnings (1), and info (2)") + } var cacheHostName string if len(*cacheHostNamePtr) > 0 { diff --git a/cache-config/t3c-apply/t3c-apply.go b/cache-config/t3c-apply/t3c-apply.go index 3055cbe3f4..c113644f71 100644 --- a/cache-config/t3c-apply/t3c-apply.go +++ b/cache-config/t3c-apply/t3c-apply.go @@ -95,8 +95,10 @@ func main() { // create and clean the config.TmpBase (/tmp/ort) if !util.MkDir(config.TmpBase, cfg) { + log.Errorln("mkdir TmpBase '" + config.TmpBase + "' failed, cannot continue") os.Exit(GeneralFailure) } else if !util.CleanTmpDir(cfg) { + log.Errorln("CleanTmpDir failed, cannot continue") os.Exit(GeneralFailure) } if cfg.RunMode != t3cutil.ModeReport { diff --git a/cache-config/t3c-apply/torequest/cmd.go b/cache-config/t3c-apply/torequest/cmd.go index b96d4f8e4e..efd2ee09e9 100644 --- a/cache-config/t3c-apply/torequest/cmd.go +++ b/cache-config/t3c-apply/torequest/cmd.go @@ -49,11 +49,19 @@ func generate(cfg config.Cfg) ([]t3cutil.ATSConfigFile, error) { return nil, errors.New("requesting: " + err.Error()) } args := []string{ - "--log-location-error=" + outToErr(cfg.LogLocationErr), - "--log-location-info=" + outToErr(cfg.LogLocationInfo), - "--log-location-warning=" + outToErr(cfg.LogLocationWarn), "--dir=" + config.TSConfigDir, } + + if cfg.LogLocationErr == log.LogLocationNull { + args = append(args, "-s") + } + if cfg.LogLocationWarn != log.LogLocationNull { + args = append(args, "-v") + } + if cfg.LogLocationInfo != log.LogLocationNull { + args = append(args, "-v") + } + if cfg.DNSLocalBind { args = append(args, "--dns-local-bind") } @@ -93,10 +101,16 @@ func generate(cfg config.Cfg) ([]t3cutil.ATSConfigFile, error) { // preprocess takes the to Data from 't3c-request --get-data=config' and the generated files from 't3c-generate', passes them to `t3c-preprocess`, and returns the result. func preprocess(cfg config.Cfg, configData []byte, generatedFiles []byte) ([]byte, error) { - args := []string{ - "--log-location-error=" + outToErr(cfg.LogLocationErr), - "--log-location-info=" + outToErr(cfg.LogLocationInfo), - "--log-location-warning=" + outToErr(cfg.LogLocationWarn), + args := []string{} + + if cfg.LogLocationErr == log.LogLocationNull { + args = append(args, "-s") + } + if cfg.LogLocationWarn != log.LogLocationNull { + args = append(args, "-v") + } + if cfg.LogLocationInfo != log.LogLocationNull { + args = append(args, "-v") } cmd := exec.Command(`t3c-preprocess`, args...) @@ -203,12 +217,21 @@ func sendUpdate(cfg config.Cfg, updateStatus bool, revalStatus bool) error { "--traffic-ops-password=" + cfg.TOPass, "--traffic-ops-url=" + cfg.TOURL, "--traffic-ops-insecure=" + strconv.FormatBool(cfg.TOInsecure), - "--log-location-error=" + outToErr(cfg.LogLocationErr), - "--log-location-info=" + outToErr(cfg.LogLocationInfo), "--cache-host-name=" + cfg.CacheHostName, "--set-update-status=" + strconv.FormatBool(updateStatus), "--set-reval-status=" + strconv.FormatBool(revalStatus), } + + if cfg.LogLocationErr == log.LogLocationNull { + args = append(args, "-s") + } + if cfg.LogLocationWarn != log.LogLocationNull { + args = append(args, "-v") + } + if cfg.LogLocationInfo != log.LogLocationNull { + args = append(args, "-v") + } + if _, used := os.LookupEnv("TO_USER"); !used { args = append(args, "--traffic-ops-user="+cfg.TOUser) } @@ -261,12 +284,21 @@ func diff(cfg config.Cfg, newFile []byte, fileLocation string) (bool, error) { // The cfgFile should be the full text of either a plugin.config or remap.config. // Returns nil if t3c-check-refs returned no errors found, or the error found if any. func checkRefs(cfg config.Cfg, cfgFile []byte, filesAdding []string) error { - stdOut, stdErr, code := t3cutil.DoInput(cfgFile, `t3c`, `check`, `refs`, - "--log-location-error="+outToErr(cfg.LogLocationErr), - "--log-location-info="+outToErr(cfg.LogLocationInfo), - "--log-location-debug="+outToErr(cfg.LogLocationDebug), - "--files-adding="+strings.Join(filesAdding, ","), - ) + args := []string{`check`, `refs`, + "--files-adding=" + strings.Join(filesAdding, ","), + } + if cfg.LogLocationErr == log.LogLocationNull { + args = append(args, "-s") + } + if cfg.LogLocationWarn != log.LogLocationNull { + args = append(args, "-v") + } + if cfg.LogLocationInfo != log.LogLocationNull { + args = append(args, "-v") + } + + stdOut, stdErr, code := t3cutil.DoInput(cfgFile, `t3c`, args...) + if code != 0 { log.Errorf(`check-refs errors start ` + string(stdOut)) @@ -338,10 +370,19 @@ func request(cfg config.Cfg, command string) ([]byte, error) { "--traffic-ops-insecure=" + strconv.FormatBool(cfg.TOInsecure), "--traffic-ops-timeout-milliseconds=" + strconv.FormatInt(int64(cfg.TOTimeoutMS), 10), "--cache-host-name=" + cfg.CacheHostName, - "--log-location-error=" + outToErr(cfg.LogLocationErr), - "--log-location-info=" + outToErr(cfg.LogLocationInfo), `--get-data=` + command, } + + if cfg.LogLocationErr == log.LogLocationNull { + args = append(args, "-s") + } + if cfg.LogLocationWarn != log.LogLocationNull { + args = append(args, "-v") + } + if cfg.LogLocationInfo != log.LogLocationNull { + args = append(args, "-v") + } + if _, used := os.LookupEnv("TO_USER"); !used { args = append(args, "--traffic-ops-user="+cfg.TOUser) } diff --git a/cache-config/t3c-check-refs/README.md b/cache-config/t3c-check-refs/README.md index a16dfc1310..a234ad09e9 100644 --- a/cache-config/t3c-check-refs/README.md +++ b/cache-config/t3c-check-refs/README.md @@ -59,39 +59,37 @@ supplied, t3c-check-refs reads its config file input from stdin. ## OPTIONS --c, --trafficserver-config-dir=value +-c, -\-trafficserver-config-dir=value directory where ATS config files are stored. [/opt/trafficserver/etc/trafficserver] --d, --log-location-debug=value - - Where to log debugs. May be a file path, stdout, stderr - --e, --log-location-error=value - - Where to log errors. May be a file path, stdout, stderr - [stderr] - --f, --files-adding=value +-f, -\-files-adding=value comma-delimited list of file names being added, to not fail to verify if they don't already exist. --h, --help +-h, -\-help Print usage information and exit --i, --log-location-info=value - - Where to log infos. May be a file path, stdout, stderr - [stderr] - --p, --trafficserver-plugin-dir=value +-p, -\-trafficserver-plugin-dir=value directory where ATS plugins are stored. [/opt/trafficserver/libexec/trafficserver] +-s, -\-silent + + Silent. Errors are not logged, and the 'verbose' flag is + ignored. If a fatal error occurs, the return code will be + non-zero but no text will be output to stderr + +-v, -\-verbose + + Log verbosity. Logging is output to stderr. By default, + errors are logged. To log warnings, pass '-v'. To log info, + pass '-vv'. To omit error logging, see '-s'. + ## EXIT CODES Returns 0 if no missing plugin DSO or config files are found. diff --git a/cache-config/t3c-check-refs/config/config.go b/cache-config/t3c-check-refs/config/config.go index 1455f5fd71..65fee66a68 100644 --- a/cache-config/t3c-check-refs/config/config.go +++ b/cache-config/t3c-check-refs/config/config.go @@ -31,6 +31,7 @@ import ( type Cfg struct { CommandArgs []string LogLocationDebug string + LogLocationWarn string LogLocationError string LogLocationInfo string TrafficServerConfigDir string @@ -46,7 +47,7 @@ var ( func (cfg Cfg) DebugLog() log.LogLocation { return log.LogLocation(cfg.LogLocationDebug) } func (cfg Cfg) ErrorLog() log.LogLocation { return log.LogLocation(cfg.LogLocationError) } func (cfg Cfg) InfoLog() log.LogLocation { return log.LogLocation(cfg.LogLocationInfo) } -func (cfg Cfg) WarningLog() log.LogLocation { return log.LogLocation(log.LogLocationNull) } // warn logging is not used. +func (cfg Cfg) WarningLog() log.LogLocation { return log.LogLocation(cfg.LogLocationWarn) } // warn logging is not used. func (cfg Cfg) EventLog() log.LogLocation { return log.LogLocation(log.LogLocationNull) } // event logging is not used. // Usage() writes command line options and usage to 'stderr' @@ -57,20 +58,39 @@ func Usage() { // InitConfig() intializes the configuration variables and loggers. func InitConfig() (Cfg, error) { - - logLocationDebugPtr := getopt.StringLong("log-location-debug", 'd', "", "Where to log debugs. May be a file path, stdout, stderr") - logLocationErrorPtr := getopt.StringLong("log-location-error", 'e', "stderr", "Where to log errors. May be a file path, stdout, stderr") - logLocationInfoPtr := getopt.StringLong("log-location-info", 'i', "stderr", "Where to log infos. May be a file path, stdout, stderr") atsConfigDirPtr := getopt.StringLong("trafficserver-config-dir", 'c', defaultATSConfigDir, "directory where ATS config files are stored.") atsPluginDirPtr := getopt.StringLong("trafficserver-plugin-dir", 'p', defaultATSPluginDir, "directory where ATS plugins are stored.") filesAdding := getopt.StringLong("files-adding", 'f', "", "comma-delimited list of file names being added, to not fail to verify if they don't already exist.") helpPtr := getopt.BoolLong("help", 'h', "Print usage information and exit") + verbosePtr := getopt.CounterLong("verbose", 'v', `Log verbosity. Logging is output to stderr. By default, errors are logged. To log warnings, pass '-v'. To log info, pass '-vv'. To omit error logging, see '-s'`) + silentPtr := getopt.BoolLong("silent", 's', `Silent. Errors are not logged, and the 'verbose' flag is ignored. If a fatal error occurs, the return code will be non-zero but no text will be output to stderr`) + getopt.Parse() if *helpPtr == true { Usage() } + logLocationError := log.LogLocationStderr + logLocationWarn := log.LogLocationNull + logLocationInfo := log.LogLocationNull + logLocationDebug := log.LogLocationNull + if *silentPtr { + logLocationError = log.LogLocationNull + } else { + if *verbosePtr >= 1 { + logLocationWarn = log.LogLocationStderr + } + if *verbosePtr >= 2 { + logLocationInfo = log.LogLocationStderr + logLocationDebug = log.LogLocationStderr // t3c only has 3 verbosity options: none (-s), error (default or --verbose=0), warning (-v), and info (-vv). Any code calling log.Debug is treated as Info. + } + } + + if *verbosePtr > 2 { + return Cfg{}, errors.New("Too many verbose options. The maximum log verbosity level is 2 (-vv or --verbose=2) for errors (0), warnings (1), and info (2)") + } + filesAddingSet := map[string]struct{}{} for _, fileAdding := range strings.Split(*filesAdding, ",") { fileAdding := strings.TrimSpace(fileAdding) @@ -82,9 +102,10 @@ func InitConfig() (Cfg, error) { cfg := Cfg{ CommandArgs: getopt.Args(), - LogLocationDebug: *logLocationDebugPtr, - LogLocationError: *logLocationErrorPtr, - LogLocationInfo: *logLocationInfoPtr, + LogLocationDebug: logLocationDebug, + LogLocationError: logLocationError, + LogLocationInfo: logLocationInfo, + LogLocationWarn: logLocationWarn, TrafficServerConfigDir: *atsConfigDirPtr, TrafficServerPluginDir: *atsPluginDirPtr, FilesAdding: filesAddingSet, diff --git a/cache-config/t3c-check-refs/t3c-check-refs.go b/cache-config/t3c-check-refs/t3c-check-refs.go index b34626aeb9..0d29cc6d18 100644 --- a/cache-config/t3c-check-refs/t3c-check-refs.go +++ b/cache-config/t3c-check-refs/t3c-check-refs.go @@ -1,38 +1,3 @@ -/* - ATS plugin readiness verifier - - This implements the ATS plugin readiness verifier as defined in the - blueprint #4628, see https://github.com/apache/trafficcontrol/pull/4628 - -Synopsis - t3c-check-refs [options] [optional_config_file] - -Description - The t3c-check-refs app will read an ATS formatted plugin.config or remap.config - file line by line and verify that the plugin '.so' files are available in the - filesystem or relative to the ATS plugin installation directory by the - absolute or relative plugin filename. - - In addition, any plugin parameters that end in '.config', '.cfg', '.txt', - 'yml' or 'yaml' are considered to be plugin configuration files and there - existence in the filesystem or relative to the ATS configuration files - directory is verified. - - The configuration file argument is optional. If no config file argument is - supplied, t3c-check-refs reads its config file input from 'stdin' - -Options - --log-location-debug=[value] | -d [value], where to log debugs, default is empty - --log-location-error=[value], | -e [value], where to log errors, default is 'stderr' - --log-location-info=[value] | -i [value], where to log infos, default is 'stderr' - --trafficserver-config-dir=[value] | -c [value], where to find ATS config files, default is '/opt/trafficserver/etc/trafficserver' --trafficserver-plugin-dir=[value] | -p [value], where to find ATS plugins, default is '/opt/trafficserver/libexec/trafficserver' --help | -h, this help message - -Exit Status - Returns 0 if no missing plugin DSO or config files are found. - Otherwise the total number of missing plugin DSO and config files - are returned. -*/ - package main /* diff --git a/cache-config/t3c-generate/README.md b/cache-config/t3c-generate/README.md index 1d70554451..b8bd5a2de1 100644 --- a/cache-config/t3c-generate/README.md +++ b/cache-config/t3c-generate/README.md @@ -54,70 +54,67 @@ The output is a JSON array of objects containing the file and its metadata. # OPTIONS --2, --default-client-enable-h2 +-2, -\-default-client-enable-h2 Whether to enable HTTP/2 on Delivery Services by default, if they have no explicit Parameter. This is irrelevant if ATS records.config is not serving H2. If omitted, H2 is disabled. --b, --dns-local-bind +-b, -\-dns-local-bind Whether to use the server's Service Addresses to set the ATS DNS local bind address. --c, --disable-parent-config-comments +-c, -\-disable-parent-config-comments Disable adding a comments to parent.config individual lines. --D, --dir=value +-D, -\-dir=value ATS config directory, used for config files without location parameters or with relative paths. May be blank. If blank and any required config file location parameter is missing or relative, will error. - -e, --log-location-error=value +-h, -\-help - Where to log errors. May be a file path, stdout, stderr, or - null. [stderr] + Print usage information and exit --h, --help +-l, -\-list-plugins - Print usage information and exit + Print the list of plugins. --i, --log-location-info=value +-r, -\-via-string-release - Where to log information messages. May be a file path, - stdout, stderr, or null. [stderr] + Whether to use the Release value from the RPM package as a + replacement for the ATS version specified in the build that + is returned in the Via and Server headers from ATS. --l, --list-plugins +-s, -\-silent - Print the list of plugins. + Silent. Errors are not logged, and the 'verbose' flag is + ignored. If a fatal error occurs, the return code will be + non-zero but no text will be output to stderr --T, --default-client-tls-versions=value +-T, -\-default-client-tls-versions=value Comma-delimited list of default TLS versions for Delivery Services with no Parameter, e.g. - '--default-tls-versions=1.1,1.2,1.3'. If omitted, all + '-\-default-tls-versions=1.1,1.2,1.3'. If omitted, all versions are enabled. --v, --version +-v, -\-verbose - Print version information and exit. + Log verbosity. Logging is output to stderr. By default, + errors are logged. To log warnings, pass '-v'. To log info, + pass '-vv'. To omit error logging, see '-s'. --V, --via-string-release +-V, -\-version - Whether to use the Release value from the RPM package as a - replacement for the ATS version specified in the build that - is returned in the Via and Server headers from ATS. - --w, --log-location-warning=value - - Where to log warnings. May be a file path, stdout, stderr, - or null. [stderr] + Print version information and exit. --y, --revalidate-only +-y, -\-revalidate-only Whether to exclude files not named 'regex_revalidate.config' diff --git a/cache-config/t3c-generate/config/config.go b/cache-config/t3c-generate/config/config.go index 37f8bf940d..43d3e34f33 100644 --- a/cache-config/t3c-generate/config/config.go +++ b/cache-config/t3c-generate/config/config.go @@ -49,6 +49,7 @@ type Cfg struct { ListPlugins bool LogLocationErr string LogLocationInfo string + LogLocationDebug string LogLocationWarn string RevalOnly bool Dir string @@ -62,24 +63,23 @@ type Cfg struct { func (cfg Cfg) ErrorLog() log.LogLocation { return log.LogLocation(cfg.LogLocationErr) } func (cfg Cfg) WarningLog() log.LogLocation { return log.LogLocation(cfg.LogLocationWarn) } func (cfg Cfg) InfoLog() log.LogLocation { return log.LogLocation(cfg.LogLocationInfo) } -func (cfg Cfg) DebugLog() log.LogLocation { return log.LogLocation(log.LogLocationNull) } // app doesn't use the debug logger, use Info instead. +func (cfg Cfg) DebugLog() log.LogLocation { return log.LogLocation(cfg.LogLocationDebug) } func (cfg Cfg) EventLog() log.LogLocation { return log.LogLocation(log.LogLocationNull) } // app doesn't use the event logger. // GetCfg gets the application configuration, from arguments and environment variables. func GetCfg() (Cfg, error) { - logLocationErr := getopt.StringLong("log-location-error", 'e', "stderr", "Where to log errors. May be a file path, stdout, stderr, or null.") - logLocationWarn := getopt.StringLong("log-location-warning", 'w', "stderr", "Where to log warnings. May be a file path, stdout, stderr, or null.") - logLocationInfo := getopt.StringLong("log-location-info", 'i', "stderr", "Where to log information messages. May be a file path, stdout, stderr, or null.") - version := getopt.BoolLong("version", 'v', "Print version information and exit.") + version := getopt.BoolLong("version", 'V', "Print version information and exit.") listPlugins := getopt.BoolLong("list-plugins", 'l', "Print the list of plugins.") help := getopt.BoolLong("help", 'h', "Print usage information and exit") revalOnly := getopt.BoolLong("revalidate-only", 'y', "Whether to exclude files not named 'regex_revalidate.config'") dir := getopt.StringLong("dir", 'D', "", "ATS config directory, used for config files without location parameters or with relative paths. May be blank. If blank and any required config file location parameter is missing or relative, will error.") - viaRelease := getopt.BoolLong("via-string-release", 'V', "Whether to use the Release value from the RPM package as a replacement for the ATS version specified in the build that is returned in the Via and Server headers from ATS.") + viaRelease := getopt.BoolLong("via-string-release", 'r', "Whether to use the Release value from the RPM package as a replacement for the ATS version specified in the build that is returned in the Via and Server headers from ATS.") dnsLocalBind := getopt.BoolLong("dns-local-bind", 'b', "Whether to use the server's Service Addresses to set the ATS DNS local bind address.") disableParentConfigComments := getopt.BoolLong("disable-parent-config-comments", 'c', "Disable adding a comments to parent.config individual lines") defaultEnableH2 := getopt.BoolLong("default-client-enable-h2", '2', "Whether to enable HTTP/2 on Delivery Services by default, if they have no explicit Parameter. This is irrelevant if ATS records.config is not serving H2. If omitted, H2 is disabled.") defaultTLSVersionsStr := getopt.StringLong("default-client-tls-versions", 'T', "", "Comma-delimited list of default TLS versions for Delivery Services with no Parameter, e.g. '--default-tls-versions=1.1,1.2,1.3'. If omitted, all versions are enabled.") + verbosePtr := getopt.CounterLong("verbose", 'v', `Log verbosity. Logging is output to stderr. By default, errors are logged. To log warnings, pass '-v'. To log info, pass '-vv'. To omit error logging, see '-s'`) + silentPtr := getopt.BoolLong("silent", 's', `Silent. Errors are not logged, and the 'verbose' flag is ignored. If a fatal error occurs, the return code will be non-zero but no text will be output to stderr`) getopt.Parse() @@ -93,6 +93,26 @@ func GetCfg() (Cfg, error) { return Cfg{ListPlugins: true}, nil } + logLocationError := log.LogLocationStderr + logLocationWarn := log.LogLocationNull + logLocationInfo := log.LogLocationNull + logLocationDebug := log.LogLocationNull + if *silentPtr { + logLocationError = log.LogLocationNull + } else { + if *verbosePtr >= 1 { + logLocationWarn = log.LogLocationStderr + } + if *verbosePtr >= 2 { + logLocationInfo = log.LogLocationStderr + logLocationDebug = log.LogLocationStderr // t3c only has 3 verbosity options: none (-s), error (default or --verbose=0), warning (-v), and info (-vv). Any code calling log.Debug is treated as Info. + } + } + + if *verbosePtr > 2 { + return Cfg{}, errors.New("Too many verbose options. The maximum log verbosity level is 2 (-vv or --verbose=2) for errors (0), warnings (1), and info (2)") + } + defaultTLSVersions := atscfg.DefaultDefaultTLSVersions *defaultTLSVersionsStr = strings.TrimSpace(*defaultTLSVersionsStr) @@ -110,9 +130,10 @@ func GetCfg() (Cfg, error) { } cfg := Cfg{ - LogLocationErr: *logLocationErr, - LogLocationWarn: *logLocationWarn, - LogLocationInfo: *logLocationInfo, + LogLocationErr: logLocationError, + LogLocationWarn: logLocationWarn, + LogLocationInfo: logLocationInfo, + LogLocationDebug: logLocationDebug, ListPlugins: *listPlugins, RevalOnly: *revalOnly, Dir: *dir, diff --git a/cache-config/t3c-request/README.md b/cache-config/t3c-request/README.md index 081361ab84..6c2fe0cca9 100644 --- a/cache-config/t3c-request/README.md +++ b/cache-config/t3c-request/README.md @@ -51,76 +51,75 @@ t3c-request [-hIprv] [-D \= 1 { + logLocationWarn = log.LogLocationStderr + } + if *verbosePtr >= 2 { + logLocationInfo = log.LogLocationStderr + logLocationDebug = log.LogLocationStderr // t3c only has 3 verbosity options: none (-s), error (default or --verbose=0), warning (-v), and info (-vv). Any code calling log.Debug is treated as Info. + } + } + + if *verbosePtr > 2 { + return Cfg{}, errors.New("Too many verbose options. The maximum log verbosity level is 2 (-vv or --verbose=2) for errors (0), warnings (1), and info (2)") } dispersion := time.Second * time.Duration(*dispersionPtr) @@ -122,9 +141,10 @@ func InitConfig() (Cfg, error) { cfg := Cfg{ CommandArgs: getopt.Args(), - LogLocationDebug: *logLocationDebugPtr, - LogLocationError: *logLocationErrorPtr, - LogLocationInfo: *logLocationInfoPtr, + LogLocationDebug: logLocationDebug, + LogLocationError: logLocationError, + LogLocationInfo: logLocationInfo, + LogLocationWarn: logLocationWarn, LoginDispersion: dispersion, TCCfg: t3cutil.TCCfg{ CacheHostName: cacheHostName, @@ -152,6 +172,7 @@ func (cfg Cfg) PrintConfig() { fmt.Printf("LogLocationDebug: %s\n", cfg.LogLocationDebug) fmt.Printf("LogLocationError: %s\n", cfg.LogLocationError) fmt.Printf("LogLocationInfo: %s\n", cfg.LogLocationInfo) + fmt.Printf("LogLocationWarn: %s\n", cfg.LogLocationWarn) fmt.Printf("LoginDispersion : %s\n", cfg.LoginDispersion) fmt.Printf("CacheHostName: %s\n", cfg.CacheHostName) fmt.Printf("TOInsecure: %v\n", cfg.TOInsecure) diff --git a/cache-config/t3c-request/t3c-request.go b/cache-config/t3c-request/t3c-request.go index 00717f7df6..cf64eb84c2 100644 --- a/cache-config/t3c-request/t3c-request.go +++ b/cache-config/t3c-request/t3c-request.go @@ -1,62 +1,3 @@ -/* -Name - t3c-request - Traffic Control cache config Traffic Ops requestor - -Synopsis - t3c-request [-hI] [-D value] [-d value] [-e value] [-H value] [-i value] \ - [-l value] [-P value] [-t value] [-u value] [-U value] - -Description - The t3c-request app is used get update status, package information, linux - chkconfig status, system info and status from Traffic Ops, see the - --get-data option. If no --get-data option is specified, the servers - system-info is fetched and returned. - -Options - -D, --get-data=value - non-config-file Traffic Ops Data to get. Valid values are - update-status, packages, chkconfig, system-info, statuses, - and config. - Default is system-info - - Note config is not versioned between t3c versions. Callers - should only pass config to other t3c commands of the same - version as the t3c-request used to produce it. - - -d, --log-location-debug=value - Where to log debugs. May be a file path, stdout or stderr. - Default is no debug logging. - -e, --log-location-error=value - Where to log errors. May be a file path, stdout, or stderr. - Default is stderr. - -i, --log-location-info=value - Where to log infos. May be a file path, stdout or stderr. - Default is stderr. - -H, --cache-host-name=value - Host name of the cache to generate config for. Must be the - server host name in Traffic Ops, not a URL, and not the FQDN. - Defaults to the OS configured hostname. - -h, --help Print usage information and exit - -I, --traffic-ops-insecure - [true | false] ignore certificate errors from Traffic Ops - -l, --login-dispersion=value - [seconds] wait a random number of seconds between 0 and - [seconds] before login to traffic ops, default 0 - -P, --traffic-ops-password=value - Traffic Ops password. Required. May also be set with the - environment variable TO_PASS - -t, --traffic-ops-timeout-milliseconds=value - Timeout in milli-seconds for Traffic Ops requests, default - is 30000 [30000] - -u, --traffic-ops-url=value - Traffic Ops URL. Must be the full URL, including the scheme. - Required. May also be set with the environment variable - TO_URL - -U, --traffic-ops-user=value - Traffic Ops username. Required. May also be set with the - environment variable TO_USER -*/ - package main /* diff --git a/cache-config/t3c-update/README.md b/cache-config/t3c-update/README.md index bb59ab3b03..5bcfafed0e 100644 --- a/cache-config/t3c-update/README.md +++ b/cache-config/t3c-update/README.md @@ -57,15 +57,6 @@ t3c-update [-ahIqv] [-d value] [-e value] [-H value] [-i value] [-l value] [-P v [true | false] sets the servers revalidate status (required) --d, --log-location-debug=value - - Where to log debugs. May be a file path, stdout, stderr - --e, --log-location-error=value - - Where to log errors. May be a file path, stdout, stderr - [stderr] - -H, --cache-host-name=value Host name of the cache to generate config for. Must be the @@ -75,11 +66,6 @@ t3c-update [-ahIqv] [-d value] [-e value] [-H value] [-i value] [-l value] [-P v Print usage information and exit --i, --log-location-info=value - - Where to log infos. May be a file path, stdout, stderr - [stderr] - -I, --traffic-ops-insecure [true | false] ignore certificate errors from Traffic Ops @@ -98,6 +84,12 @@ t3c-update [-ahIqv] [-d value] [-e value] [-H value] [-i value] [-l value] [-P v [true | false] sets the servers update status (required) +-s, -\-silent + + Silent. Errors are not logged, and the 'verbose' flag is + ignored. If a fatal error occurs, the return code will be + non-zero but no text will be output to stderr + -t, --traffic-ops-timeout-milliseconds=value Timeout in milli-seconds for Traffic Ops requests, default @@ -114,7 +106,13 @@ t3c-update [-ahIqv] [-d value] [-e value] [-H value] [-i value] [-l value] [-P v Traffic Ops username. Required. May also be set with the environment variable TO_USER --v, --version +-v, -\-verbose + + Log verbosity. Logging is output to stderr. By default, + errors are logged. To log warnings, pass '-v'. To log info, + pass '-vv'. To omit error logging, see '-s'. + +-V, --version Print the version and exit diff --git a/cache-config/t3c-update/config/config.go b/cache-config/t3c-update/config/config.go index d6b318c57d..eea9b4df61 100644 --- a/cache-config/t3c-update/config/config.go +++ b/cache-config/t3c-update/config/config.go @@ -41,6 +41,7 @@ type Cfg struct { LogLocationDebug string LogLocationError string LogLocationInfo string + LogLocationWarn string LoginDispersion time.Duration CacheHostName string GetData string @@ -52,7 +53,7 @@ type Cfg struct { func (cfg Cfg) DebugLog() log.LogLocation { return log.LogLocation(cfg.LogLocationDebug) } func (cfg Cfg) ErrorLog() log.LogLocation { return log.LogLocation(cfg.LogLocationError) } func (cfg Cfg) InfoLog() log.LogLocation { return log.LogLocation(cfg.LogLocationInfo) } -func (cfg Cfg) WarningLog() log.LogLocation { return log.LogLocation(log.LogLocationNull) } // warn logging is not used. +func (cfg Cfg) WarningLog() log.LogLocation { return log.LogLocation(cfg.LogLocationWarn) } func (cfg Cfg) EventLog() log.LogLocation { return log.LogLocation(log.LogLocationNull) } // event logging is not used. // Usage() writes command line options and usage to 'stderr' @@ -63,9 +64,6 @@ func Usage() { // InitConfig() intializes the configuration variables and loggers. func InitConfig() (Cfg, error) { - logLocationDebugPtr := getopt.StringLong("log-location-debug", 'd', "", "Where to log debugs. May be a file path, stdout, stderr") - logLocationErrorPtr := getopt.StringLong("log-location-error", 'e', "stderr", "Where to log errors. May be a file path, stdout, stderr") - logLocationInfoPtr := getopt.StringLong("log-location-info", 'i', "stderr", "Where to log infos. May be a file path, stdout, stderr") dispersionPtr := getopt.IntLong("login-dispersion", 'l', 0, "[seconds] wait a random number of seconds between 0 and [seconds] before login to traffic ops, default 0") cacheHostNamePtr := getopt.StringLong("cache-host-name", 'H', "", "Host name of the cache to generate config for. Must be the server host name in Traffic Ops, not a URL, and not the FQDN") var updatePendingPtr bool @@ -78,7 +76,9 @@ func InitConfig() (Cfg, error) { toUserPtr := getopt.StringLong("traffic-ops-user", 'U', "", "Traffic Ops username. Required. May also be set with the environment variable TO_USER") toPassPtr := getopt.StringLong("traffic-ops-password", 'P', "", "Traffic Ops password. Required. May also be set with the environment variable TO_PASS ") helpPtr := getopt.BoolLong("help", 'h', "Print usage information and exit") - versionPtr := getopt.BoolLong("version", 'v', "Print the version") + versionPtr := getopt.BoolLong("version", 'V', "Print the version") + verbosePtr := getopt.CounterLong("verbose", 'v', `Log verbosity. Logging is output to stderr. By default, errors are logged. To log warnings, pass '-v'. To log info, pass '-vv'. To omit error logging, see '-s'`) + silentPtr := getopt.BoolLong("silent", 's', `Silent. Errors are not logged, and the 'verbose' flag is ignored. If a fatal error occurs, the return code will be non-zero but no text will be output to stderr`) getopt.Parse() @@ -89,6 +89,26 @@ func InitConfig() (Cfg, error) { fmt.Println(AppName + " v" + Version) } + logLocationError := log.LogLocationStderr + logLocationWarn := log.LogLocationNull + logLocationInfo := log.LogLocationNull + logLocationDebug := log.LogLocationNull + if *silentPtr { + logLocationError = log.LogLocationNull + } else { + if *verbosePtr >= 1 { + logLocationWarn = log.LogLocationStderr + } + if *verbosePtr >= 2 { + logLocationInfo = log.LogLocationStderr + logLocationDebug = log.LogLocationStderr // t3c only has 3 verbosity options: none (-s), error (default or --verbose=0), warning (-v), and info (-vv). Any code calling log.Debug is treated as Info. + } + } + + if *verbosePtr > 2 { + return Cfg{}, errors.New("Too many verbose options. The maximum log verbosity level is 2 (-vv or --verbose=2) for errors (0), warnings (1), and info (2)") + } + dispersion := time.Second * time.Duration(*dispersionPtr) toTimeoutMS := time.Millisecond * time.Duration(*toTimeoutMSPtr) toURL := *toURLPtr @@ -126,9 +146,10 @@ func InitConfig() (Cfg, error) { cfg := Cfg{ CommandArgs: getopt.Args(), - LogLocationDebug: *logLocationDebugPtr, - LogLocationError: *logLocationErrorPtr, - LogLocationInfo: *logLocationInfoPtr, + LogLocationDebug: logLocationDebug, + LogLocationError: logLocationError, + LogLocationInfo: logLocationInfo, + LogLocationWarn: logLocationWarn, LoginDispersion: dispersion, UpdatePending: updatePendingPtr, RevalPending: revalPendingPtr, diff --git a/cache-config/testing/docker/ort_test/run.sh b/cache-config/testing/docker/ort_test/run.sh index 0627177af9..1a6a4db408 100755 --- a/cache-config/testing/docker/ort_test/run.sh +++ b/cache-config/testing/docker/ort_test/run.sh @@ -33,9 +33,7 @@ function ping_to { "--traffic-ops-password=$TO_ADMIN_PASS" \ "--traffic-ops-url=$TO_URI" \ "--cache-host-name=atlanta-edge-03" \ - "--log-location-error=stderr" \ - "--log-location-info=stderr" \ - "--log-location-debug=stderr" \ + "-vv" \ "--run-mode=badass" } diff --git a/cache-config/testing/ort-tests/t3c-apply-unset-update_test.go b/cache-config/testing/ort-tests/t3c-apply-unset-update_test.go index efbd90e7d5..139e1048f9 100644 --- a/cache-config/testing/ort-tests/t3c-apply-unset-update_test.go +++ b/cache-config/testing/ort-tests/t3c-apply-unset-update_test.go @@ -142,9 +142,7 @@ func t3cUpdateUnsetFlag(host string, runMode string) (string, int) { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=stdout", - "--log-location-info=stdout", - "--log-location-debug=test.log", + "-vv", "--omit-via-string-release=true", "--git=no", "--run-mode=" + runMode, diff --git a/cache-config/testing/ort-tests/t3c-apply-wait-for-parents_test.go b/cache-config/testing/ort-tests/t3c-apply-wait-for-parents_test.go index 0a94b75068..1feb24cf71 100644 --- a/cache-config/testing/ort-tests/t3c-apply-wait-for-parents_test.go +++ b/cache-config/testing/ort-tests/t3c-apply-wait-for-parents_test.go @@ -333,9 +333,7 @@ func t3cUpdateWaitForParents(host string, runMode string, waitForParents *string "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=stdout", - "--log-location-info=stdout", - "--log-location-debug=stdout", + "-vv", "--run-mode=" + runMode, "--git=no", "--dns-local-bind", diff --git a/cache-config/testing/ort-tests/t3c-create-empty-file_test.go b/cache-config/testing/ort-tests/t3c-create-empty-file_test.go index 779156443b..c5f1fbcac9 100644 --- a/cache-config/testing/ort-tests/t3c-create-empty-file_test.go +++ b/cache-config/testing/ort-tests/t3c-create-empty-file_test.go @@ -77,10 +77,7 @@ func t3cUpdateCreateEmptyFile(host string, run_mode string) error { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", - "--log-location-debug=test.log", + "-vv", "--omit-via-string-release=true", "--run-mode=" + run_mode, "--git=no", diff --git a/cache-config/testing/ort-tests/t3c-dns-local-bind_test.go b/cache-config/testing/ort-tests/t3c-dns-local-bind_test.go index 0ca4ebfa01..269502d8ef 100644 --- a/cache-config/testing/ort-tests/t3c-dns-local-bind_test.go +++ b/cache-config/testing/ort-tests/t3c-dns-local-bind_test.go @@ -62,9 +62,7 @@ func t3cUpdateDNSLocalBind(host string, run_mode string) error { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", + "-vv", "--run-mode=" + run_mode, "--git=no", "--dns-local-bind", diff --git a/cache-config/testing/ort-tests/t3c-git_test.go b/cache-config/testing/ort-tests/t3c-git_test.go index 99c89fc0a6..d7e9a62995 100644 --- a/cache-config/testing/ort-tests/t3c-git_test.go +++ b/cache-config/testing/ort-tests/t3c-git_test.go @@ -135,10 +135,8 @@ func t3cUpdateGit(host string, run_mode string) error { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", - "--log-location-debug=test.log", + "--verbose", // first verbose option to enable warnings + "--verbose", // second verbose option to enable info "--omit-via-string-release=true", "--run-mode=" + run_mode, "--git=" + "yes", diff --git a/cache-config/testing/ort-tests/t3c-reload_test.go b/cache-config/testing/ort-tests/t3c-reload_test.go index bc26386853..ecac1e0602 100644 --- a/cache-config/testing/ort-tests/t3c-reload_test.go +++ b/cache-config/testing/ort-tests/t3c-reload_test.go @@ -259,13 +259,11 @@ func t3cUpdateReload(host string, runMode string) (string, int) { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=stdout", - "--log-location-info=stdout", - "--log-location-debug=test.log", + "-vv", "--omit-via-string-release=true", "--git=" + "yes", "--run-mode=" + runMode, } - stdOut, _, exitCode := t3cutil.Do("t3c", args...) // should be no stderr, we told it to log to stdout - return string(stdOut), exitCode + _, stdErr, exitCode := t3cutil.Do("t3c", args...) + return string(stdErr), exitCode } diff --git a/cache-config/testing/ort-tests/to_requester_test.go b/cache-config/testing/ort-tests/to_requester_test.go index e3efdf398d..de39354234 100644 --- a/cache-config/testing/ort-tests/to_requester_test.go +++ b/cache-config/testing/ort-tests/to_requester_test.go @@ -123,9 +123,7 @@ func ExecTORequester(host string, data_req string) (string, error) { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", + "-vv", "--get-data=" + data_req, } cmd := exec.Command("/usr/bin/t3c-request", args...) diff --git a/cache-config/testing/ort-tests/to_updater_test.go b/cache-config/testing/ort-tests/to_updater_test.go index 0944f38e7e..5051018814 100644 --- a/cache-config/testing/ort-tests/to_updater_test.go +++ b/cache-config/testing/ort-tests/to_updater_test.go @@ -112,9 +112,7 @@ func ExecTOUpdater(host string, reval_status bool, update_status bool) error { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", + "-vv", "--set-reval-status=" + strconv.FormatBool(reval_status), "--set-update-status=" + strconv.FormatBool(update_status), } diff --git a/cache-config/testing/ort-tests/traffic_ops_ort_test.go b/cache-config/testing/ort-tests/traffic_ops_ort_test.go index 9190a342c9..61419cb1ca 100644 --- a/cache-config/testing/ort-tests/traffic_ops_ort_test.go +++ b/cache-config/testing/ort-tests/traffic_ops_ort_test.go @@ -124,7 +124,7 @@ func TestMain(m *testing.M) { func runCheckRefs(config_file string) error { args := []string{ - "--log-location-debug=test.log", + "--verbose=2", config_file, } cmd := exec.Command("t3c-check-refs", args...) @@ -149,9 +149,7 @@ func runRequest(host string, getData string) ([]byte, error) { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", + "--verbose=2", // errors, warnings, and info+debug "--get-data=" + getData, } cmd := exec.Command("t3c", args...) @@ -177,9 +175,7 @@ func runApply(host string, run_mode string, dispersion time.Duration) error { "--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword, "--traffic-ops-url=" + tcd.Config.TrafficOps.URL, "--cache-host-name=" + host, - "--log-location-error=test.log", - "--log-location-info=test.log", - "--log-location-debug=test.log", + "-vv", "--omit-via-string-release=true", "--git=no", "--run-mode=" + run_mode, diff --git a/infrastructure/cdn-in-a-box/cache/run.sh b/infrastructure/cdn-in-a-box/cache/run.sh index c5f2d419f8..48b781d156 100755 --- a/infrastructure/cdn-in-a-box/cache/run.sh +++ b/infrastructure/cdn-in-a-box/cache/run.sh @@ -118,7 +118,7 @@ hostname="${hostname^^}" # uppercase debug_variable_name="T3C_DEBUG_COMPONENT_${hostname}" debug_binary="${!debug_variable_name}" if ! type -p "$debug_binary"; then - t3c apply --run-mode=badass --traffic-ops-url="$TO_URL" --traffic-ops-user="$TO_USER" --traffic-ops-password="$TO_PASSWORD" --git=yes --dispersion=0 --log-location-error=stdout --log-location-warning=stdout --log-location-info=stdout all || { echo "Failed"; } + t3c apply --run-mode=badass --traffic-ops-url="$TO_URL" --traffic-ops-user="$TO_USER" --traffic-ops-password="$TO_PASSWORD" --git=yes --dispersion=0 -vv || { echo "Failed"; } fi envsubst < "/etc/cron.d/traffic_ops_ort-cron-template" > "/etc/cron.d/traffic_ops_ort-cron" && rm -f "/etc/cron.d/traffic_ops_ort-cron-template" diff --git a/infrastructure/cdn-in-a-box/cache/traffic_ops_ort.crontab b/infrastructure/cdn-in-a-box/cache/traffic_ops_ort.crontab index b6c8a6c6ad..1f8fef91c1 100644 --- a/infrastructure/cdn-in-a-box/cache/traffic_ops_ort.crontab +++ b/infrastructure/cdn-in-a-box/cache/traffic_ops_ort.crontab @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -*/1 * * * * t3c apply --run-mode=syncds --traffic-ops-url=$TO_URL --traffic-ops-user=$TO_USER --traffic-ops-password=$TO_PASSWORD --git=yes --login-dispersion=0 --dispersion=0 --log-location-error=stdout --log-location-warning=stdout --log-location-info=stdout all >> /var/log/ort.log +*/1 * * * * t3c apply --run-mode=syncds --traffic-ops-url=$TO_URL --traffic-ops-user=$TO_USER --traffic-ops-password=$TO_PASSWORD --git=yes --login-dispersion=0 --dispersion=0 -vv 2>&1 >> /var/log/ort.log