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

[release-1.0] Update SyncPluginsForTarget API to allow configuring stdout and stderr externally #89

Merged

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Aug 18, 2023

Cherry-pick: #88 , #90

What this PR does / why we need it

This change exposes additional CommandOptions to configure the outputWriter and errorWriter using WithOutputWriter and WithErrorWriter options when invoking the TanzuPluginSyncForTarget API, along with writing the output directly to the os.Stdout and os.Stderr by default.

Note: Unlike before, the API will now write the output/error of the plugin sync operation to stderr and stdout by default. Callers who previously manage the output by processing the return values of the API call should consider turning off the default writing to the os.Stdout and os.Stderr by passing WithNoStdout and WithNoStderr options as the additional parameters to the function call in order to avoid duplicate echoing.

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

Release note

Fix the `SyncPluginsForTarget` API to allow configuring the `OutputStream` and `ErrorStream` externally. If not configured it defaults the writes to `os.Stdout` and `os.Stderr`

Additional information

Special notes for your reviewer

…r externally

This change exposes additional CommandOptions to configure the outputWriter and errorWriter using WithOutputWriter and WithErrorWriter options when invoking the TanzuPluginSyncForTarget API, along with writing the output directly to the os.Stdout and os.Stderr by default.

Note: Unlike before, the API will now write the output/error of the plugin sync operation to stderr and stdout by default. Callers who previously manage the output by processing the return values of the API call should consider turning off the default writing to the os.Stdout and os.Stderr by passing WithNoStdout and WithNoStderr options as the additional parameters to the function call in order to avoid duplicate echoing.
@anujc25 anujc25 requested a review from a team as a code owner August 18, 2023 20:56
plugin/sync_plugins.go Outdated Show resolved Hide resolved
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks!

Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks

@anujc25 anujc25 merged commit f6033c3 into vmware-tanzu:release-1.0 Aug 28, 2023
1 check passed
@marckhouzam marckhouzam added this to the v1.0.2 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants