-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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 'kubectl cp' with no arguments causes a panic #65482
Conversation
/priority important-soon |
pkg/kubectl/cmd/cp.go
Outdated
@@ -164,6 +164,9 @@ func (o *CopyOptions) Validate(cmd *cobra.Command, args []string) error { | |||
} | |||
|
|||
func (o *CopyOptions) Run(args []string) error { | |||
if len(args) < 2 { | |||
return fmt.Errorf("Unexpected args: %v", args) |
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.
I think suggesting to the user what is required might make more sense:
a source and a destination are required
or something along those lines
14d6e4d
to
630bbf1
Compare
/test pull-kubernetes-e2e-gce |
/lgtm |
/assign @janetkuo |
NOTE: |
/sig cli |
Does this also fix panic in #65475 (comment) ie. |
Answering myself: no. The fix specifically handles case with no arguments at all. |
/retest
…On Sun 1 Jul, 2018, 3:03 PM k8s-ci-robot, ***@***.***> wrote:
@wgliang <https://github.com/wgliang>: The following test *failed*, say
/retest to rerun them all:
Test name Commit Details Rerun command
pull-kubernetes-e2e-gce 630bbf1
<630bbf1>
link
<https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/65482/pull-kubernetes-e2e-gce/42796/> /test
pull-kubernetes-e2e-gce
Full PR test history <https://k8s-gubernator.appspot.com/pr/65482>. Your
PR dashboard <https://k8s-gubernator.appspot.com/pr/wgliang>. Please help
us cut down on flakes by linking to
<https://git.k8s.io/community/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests>
an open issue
<https://github.com/kubernetes/kubernetes/issues?q=is:issue+is:open> when
you hit one in your PR.
Instructions for interacting with me using PR comments are available here
<https://git.k8s.io/community/contributors/guide/pull-requests.md>. If
you have questions or suggestions related to my behavior, please file an
issue against the kubernetes/test-infra
<https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:>
repository. I understand the commands that are listed here
<https://go.k8s.io/bot-commands>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#65482 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APXA0EwKWx5nZTDlkp4ENY-IVX0qb2rGks5uCJdbgaJpZM4U4Dgo>
.
|
/ping @kubernetes/sig-cli-maintainers |
/lgtm @soltysh for approval |
pkg/kubectl/cmd/cp.go
Outdated
@@ -164,6 +164,9 @@ func (o *CopyOptions) Validate(cmd *cobra.Command, args []string) error { | |||
} | |||
|
|||
func (o *CopyOptions) Run(args []string) error { | |||
if len(args) < 2 { | |||
return fmt.Errorf("Unexpected args: %v, a source and a destination are required", args) |
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.
Just source and destination are required
will be sufficient.
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.
Done,
for approve
630bbf1
to
254b02b
Compare
/retest |
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CaoShuFeng, juanvallejo, soltysh, wgliang 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 |
/test pull-kubernetes-e2e-kops-aws |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
/kind bug
"kubectl cp" with no arguments causes a panic
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 #65475
Special notes for your reviewer:
Release note: