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
vmexport: Reject volume exports when no output file is specified #10963
vmexport: Reject volume exports when no output file is specified #10963
Conversation
The option sound reasonable to me |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alicefr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest-required |
/hold |
@awels @alromeros how about we make the output a must when doing download (as Alvaro did to return an error) but make stdout a valid output for piping purposes and so also change the error msg to "must set output value" and maybe give in the examples the stout option so people will know its possible. |
I agree with Shelly. We should not mess the terminal if somebody is missing the flag by accident. |
15d908e
to
abc4b7f
Compare
When no output is specified, all vmexport downloads are dumped into stdout. This commit improves the error handling to reject volume downloads when no output file is specified. Signed-off-by: Alvaro Romero <alromero@redhat.com>
abc4b7f
to
cc1db17
Compare
Updated this to match curl's behavior:
|
/retest-required |
1 similar comment
/retest-required |
/lgtm |
/unhold |
@@ -347,7 +347,7 @@ func (c *command) initVMExportInfo(vmeInfo *VMExportInfo) error { | |||
vmeInfo.ExportSource = getExportSource() | |||
vmeInfo.OutputFile = outputFile | |||
// User wants the output in a file, create | |||
if outputFile != "" { | |||
if outputFile != "" && outputFile != "-" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't allow outputFile to be "" so you dont need to check it right?
what about someone explicitly doing --outputFile=stdout? we dont want that to go to stdout? is it not acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we allow empty output files for manifest downloads. Also, I think it's good to be consistent and allow using whatever file name (even stdout).
/retest-required |
@alromeros: The following tests failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
What this PR does / why we need it:
When no output is specified, all vmexport downloads are dumped into stdout. This Pull Request improves the error handling to reject volume downloads when no output file is specified to avoid unexpected binary dumps.
Example before fix:
After fix:
Manifest downloads are still able to dump into stdout without specifying output.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes # https://issues.redhat.com/browse/CNV-36271
Special notes for your reviewer:
Release note: