Open rajaskakodkar opened 2 years ago
tanzu cluster list should return Downloading of TKG BOM to stdout instead of stderr
I would think especially with --output=json
, this would not be the desired behavior. That would mix the progress information with the JSON response of a command, which would mess up any piped operations to something like jq
.
I think the bigger issue is that something like cluster list
is even emitting anything to do with downloading a BOM.
For some additional context, it looks like all console output goes to stderr instead of stdout as a result of this line:
https://github.com/vmware-tanzu/tanzu-framework/blob/main/pkg/v1/tkg/log/writer.go#L112-L115
According to @anujc25:
Currently there are multiple types of outputs we are writing. Regular output (like the actual result command in table, json, yaml format) goes to stdout . Whereas any log lines (info, warning, error) goes to stderr. Because it would be quite hard to distinguish between normal flow output like command output (in table, json, yaml format) and normal log lines that was used to redirect from stdout.
It appears that as part of the cluster list
operation, bom file downloading is treated as INFO, and thereby outputted to stderr.
Bug description
tanzu cluster list
call is not behaving as expected. Some errors returned as stderr like below:Affected product area (please put an X in all that apply)
Expected behavior
tanzu cluster list
should returnDownloading of TKG BOM
tostdout
instead ofstderr
Steps to reproduce the bug
Create a management-cluster preferably on AWS and a workload cluster and run
tanzu cluster list --include-management-cluster --output=json
Version (include the SHA if the version is not obvious) 52af51fc81daccc180cb874ef7b21f959da3167d
Environment where the bug was observed (cloud, OS, etc) Cloud: AWS
Relevant Debug Output (Logs, manifests, etc)