-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
kops get ...
should exit with non-zero if the resource don't exist
#3610
Conversation
Without this change, `kops get --name non-existing-cluster` will exit with a status of `0`, which makes it difficult to check if a cluster (and other resources) exist in a shell script.
Hi @erickt. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. 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. |
Yup this is a bug ... I do not think I will claim it ... but happy you fixed it :) I think we have an issue open for this, if I remember. |
@@ -125,8 +125,7 @@ func RunGet(context Factory, out io.Writer, options *GetOptions) error { | |||
} | |||
|
|||
if cluster == nil { | |||
fmt.Fprintf(os.Stderr, "No cluster found\n") | |||
return nil | |||
return fmt.Errorf("No cluster found") |
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.
We can do another PR, but I think we should be printing out the name, if we have one
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrislovecnm The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/ok-to-test |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
Without this change,
kops get --name non-existing-cluster
will exit with a status of0
, which makes it difficult to check if a cluster (and other resources) exist in a shell script.cc @chrislovecnm, who I think originally wrote this code.