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

Confusing Error Message When Using kn service update #829

Closed
danielhelfand opened this issue May 7, 2020 · 9 comments
Closed

Confusing Error Message When Using kn service update #829

danielhelfand opened this issue May 7, 2020 · 9 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@danielhelfand
Copy link
Contributor

Bug report

When using kn service update with the helloworld-go service example, an odd error response comes when you run the following:

kn service update helloworld-go --env TARGET=Go Sample v2
'service update' requires the service name given as single argument

The issue has nothing to do with the service name argument. The issue is that --env TARGET=Go Sample v2 should be a string: --env TARGET="Go Sample v2".

Possibly related to #762 and #778.

Expected behavior

An error message along the lines of --env TARGET must be a string.

It seems as if this error comes up as unexpected in an area where a hard coded error message is in place for a specific issue.

Steps to reproduce the problem

  1. Create the helloworld-go service mentioned above
  2. Attempt to update the service with kn service update helloworld-go --env TARGET=Go Sample v2 without double quotes around the value of TARGET.

kn version

Version:      v0.14.0
Build Date:   2020-04-22 08:56:32
Git Revision: c41e9fd
Supported APIs:
* Serving
  - serving.knative.dev/v1 (knative-serving v0.14.0)
* Eventing
  - sources.knative.dev/v1alpha2 (knative-eventing v0.14.1)
  - eventing.knative.dev/v1alpha1 (knative-eventing v0.14.1)

Knative (serving/eventing) version

Serving: v0.14.0

@danielhelfand danielhelfand added the kind/bug Categorizes issue or PR as related to a bug. label May 7, 2020
@rhuss
Copy link
Contributor

rhuss commented May 7, 2020

It's indeed confusing here, but it's hard or even impossible for kn to detect that you forgot quotes for your label. For kn you called kn service update with three, non-flag arguments: "hello-world-go", "Sample" and "v2". The error message reports that you must only use a single argument which has to be the name of the service to update.

Maybe instead of

'service update' requires the service name given as single argument

rephrasing this to

'service update' requires the service name as single non-flag argument

sounds better ?

Happy for any other suggestion, though.

@MIBc
Copy link
Contributor

MIBc commented May 7, 2020

In kubectl , it raises error: exactly one NAME is required, got 2 :)

@navidshaikh
Copy link
Collaborator

navidshaikh commented May 8, 2020

I think we should document quoting space separated flag values. Handling at kn level (instead of cobra) would bring multiple combinations to handle and complexity.

Ideally, the error message should come from the flag parsing library where it recognizes the pattern where command requires arg(s) and there are multiple values passed after = for flags.

@danielhelfand
Copy link
Contributor Author

Ideally, the error message should come from the flag parsing library where it recognizes the pattern where command requires arg(s) and there are multiple values passed after = for flags.

Agree on this. Would be great if there was some flag-level validation on this, but I also think I can agree that a documented example might be the best way to go here. I realize this issue is a bit nitpicky as far as this error is concerned.

@rhuss
Copy link
Contributor

rhuss commented May 12, 2020

I don't think this is easily possible as it is pefectly valid to use a command like kn service create --env MYENV=value myservicename. It's just that a space is an argument separator for any command, and tbh I would expect that a user on the teminal is aware of this (as the same behaviour applies to any unix command).

But the error message should be better. Like when multiple arguments are given we can say: "Only one argument for the name is allowed, but multiple are given: 'helloworld-go Sample v2'. Maybe you have forgotten to quote a flag value ?"

@rhuss
Copy link
Contributor

rhuss commented May 12, 2020

Repeating the detected arguments in the error message might be just good enough.

@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 15, 2020
@rhuss
Copy link
Contributor

rhuss commented Dec 1, 2020

Reopen it as I think we can still do better with the error message.

@rhuss rhuss reopened this Dec 1, 2020
@github-actions github-actions bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 23, 2021
@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 24, 2021
dsimansk pushed a commit to dsimansk/client that referenced this issue Oct 8, 2021
* Tekton test - ClusterRoleBinding v1

* make it compatible with Kubernetes 1.22

* TMP: Test Tekton in presubmits

* Revert "TMP: Test Tekton in presubmits"

This reverts commit 8996ac7.

Co-authored-by: Martin Gencur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants