Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(*) send tool output to stdout #2787

Merged
merged 1 commit into from
Sep 20, 2021
Merged

fix(*) send tool output to stdout #2787

merged 1 commit into from
Sep 20, 2021

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Sep 20, 2021

Summary

Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

$ kumactl version 
WARNING: Unable to confirm the server supports this kumactl version
Kuma: 1.2.0-233-g731d6e34
$ kumactl version 2>/dev/null
Kuma: 1.2.0-233-g731d6e34
$ 

Full changelog

  • Fix the Kuma command-line tools to correctly send normal output to standard out and errors to standard error.

Issues resolved

Fix #2786

Documentation

N/A

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

Backwards compatibility

  • Add backport-to-stable label if the code is backwards compatible. Otherwise, list breaking changes.

Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

This fixes #2786.

Signed-off-by: James Peach <james.peach@konghq.com>
@jpeach jpeach requested a review from a team as a code owner September 20, 2021 06:20
@codecov-commenter
Copy link

Codecov Report

Merging #2787 (1560dca) into master (731d6e3) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2787      +/-   ##
==========================================
+ Coverage   52.07%   52.14%   +0.07%     
==========================================
  Files         880      880              
  Lines       51260    51263       +3     
==========================================
+ Hits        26692    26732      +40     
+ Misses      22460    22410      -50     
- Partials     2108     2121      +13     
Impacted Files Coverage Δ
app/kuma-cp/cmd/root.go 53.65% <100.00%> (+1.15%) ⬆️
app/kuma-dp/cmd/root.go 68.29% <100.00%> (+0.79%) ⬆️
app/kumactl/cmd/root.go 74.13% <100.00%> (+0.45%) ⬆️
pkg/mads/v1/client/client.go 41.25% <0.00%> (-2.50%) ⬇️
api/observability/v1/mads.pb.go 34.53% <0.00%> (-1.04%) ⬇️
pkg/core/resources/manager/cache.go 81.81% <0.00%> (ø)
pkg/insights/resyncer.go 67.16% <0.00%> (+2.98%) ⬆️
pkg/plugins/resources/memory/store.go 82.06% <0.00%> (+4.34%) ⬆️
pkg/events/eventbus.go 92.59% <0.00%> (+7.40%) ⬆️
pkg/xds/cache/once/cache.go 94.87% <0.00%> (+7.69%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 731d6e3...1560dca. Read the comment docs.

@jakubdyszkiewicz
Copy link
Contributor

why would Cobra make such a change?

@jpeach jpeach merged commit a9245c5 into kumahq:master Sep 20, 2021
@jpeach jpeach deleted the fix/cmd-out-stdout branch September 20, 2021 22:29
mergify bot pushed a commit that referenced this pull request Sep 20, 2021
Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

This fixes #2786.

Signed-off-by: James Peach <james.peach@konghq.com>
(cherry picked from commit a9245c5)
jpeach added a commit that referenced this pull request Sep 20, 2021
Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

This fixes #2786.

Signed-off-by: James Peach <james.peach@konghq.com>
(cherry picked from commit a9245c5)

Co-authored-by: James Peach <james.peach@konghq.com>
lahabana pushed a commit to lahabana/kuma that referenced this pull request Sep 21, 2021
Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

This fixes kumahq#2786.

Signed-off-by: James Peach <james.peach@konghq.com>
nikita15p pushed a commit to nikita15p/kuma that referenced this pull request Sep 28, 2021
Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

This fixes kumahq#2786.

Signed-off-by: James Peach <james.peach@konghq.com>
nikita15p pushed a commit to nikita15p/kuma that referenced this pull request Sep 28, 2021
Cobra defaults to writing all output to stderr. Change each root command
to set the standard output stream to stdout so that normal and error
output is separated as expected.

This fixes kumahq#2786.

Signed-off-by: James Peach <james.peach@konghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kumactl command print functions send output to stderr not to stdout
3 participants