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

Better warning message when kapp things you gave it empty input. #249

Closed
GrahamDumpleton opened this issue Jul 15, 2021 · 6 comments · Fixed by #260
Closed

Better warning message when kapp things you gave it empty input. #249

GrahamDumpleton opened this issue Jul 15, 2021 · 6 comments · Fixed by #260
Assignees
Labels
carvel accepted This issue should be considered for future work and that the triage process has been completed enhancement This issue is a feature request

Comments

@GrahamDumpleton
Copy link

Describe the problem/challenge you have

Run:

cat resources.yaml | kapp deploy -a website -y

One will get an error message saying:

kapp: Error: Trying to apply empty set of resources will result in deletion of resources on cluster. Refusing to continue unless --dangerous-allow-empty-list-of-resources is specified.

This isn't useful in understanding the obvious mistake you likely made.

Describe the solution you'd like

Reword the message to something like:

kapp: Error: Trying to apply empty set of resources will result in deletion of resources on cluster. Did you forget to supply the -f/--file option? Refusing to continue unless --dangerous-allow-empty-list-of-resources is specified.

In other words suggest maybe the issue is they forgot to provide the -f or --file option.

In this case what was actually required was -f - and if it can detect that stdin wasn't closed but something was being piped to kapp then maybe it can be even more specific and ask if -f - was forgotten.

Anything else you would like to add:

I get confused by this message every time when I forget the -f option. :-(


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

cc @jorgemoralespou

@GrahamDumpleton GrahamDumpleton added carvel triage This issue has not yet been reviewed for validity enhancement This issue is a feature request labels Jul 15, 2021
@GrahamDumpleton
Copy link
Author

BTW, when would -f not be a mandatory option with kapp deploy. So why shouldn't it just outright error when it is missing based on that?

@cppforlife
Copy link
Contributor

BTW, when would -f not be a mandatory option with kapp deploy. So why shouldn't it just outright error when it is missing based on that?

that's a good point. ill have to think why isnt the case right now...

@renuy renuy self-assigned this Jul 19, 2021
@GrahamDumpleton
Copy link
Author

Another example to take into consideration when changing this.

When piping from ytt and the error is in ytt you will get:

$ ytt -f templates-v2 --data-values-file override-values.yaml | kapp deploy -a website -f - -y
ytt: Error: 
- string has no .hostname field or method
    in <toplevel>
      ingress.yaml:3 | #@ if data.values.website.ingress.hostname and data.values.website.ingress.domain:
Target cluster 'https://10.96.0.1:443'

kapp: Error: Trying to apply empty set of resources will result in deletion of resources on cluster. Refusing to continue unless --dangerous-allow-empty-list-of-resources is specified.

You aren't going to avoid the cascading errors in this case, so just need to be mindful of how changes in the message will appear in this sort of situation.

@renuy renuy added carvel accepted This issue should be considered for future work and that the triage process has been completed and removed carvel triage This issue has not yet been reviewed for validity labels Jul 28, 2021
@renuy
Copy link
Contributor

renuy commented Jul 28, 2021

Things we are planning to do as part of this issue:

  1. Improve the warning message
  2. make atleast one -f mandatory

@renuy
Copy link
Contributor

renuy commented Jul 29, 2021

@cppforlife ,
Is the file option not mandatory, because we want to support --dangerous-allow-empty-list-of-resources?

@cppforlife
Copy link
Contributor

because we want to support --dangerous-allow-empty-list-of-resources?

nah, that flag just indicates that its ok if given file(s) has 0 resources inside. i think i just never added a validation check for -f for no good reason.

@renuy renuy linked a pull request Aug 9, 2021 that will close this issue
@renuy renuy modified the milestones: Kapp release 0.38, [Kapp] v0.38.0 Aug 17, 2021
@renuy renuy closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
carvel accepted This issue should be considered for future work and that the triage process has been completed enhancement This issue is a feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants