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

Return a non-zero status code for failed plugins #463

Merged
merged 1 commit into from
Jul 9, 2018

Conversation

chuckha
Copy link
Contributor

@chuckha chuckha commented Jul 3, 2018

Fixes #404

Signed-off-by: Chuck Ha chuck@heptio.com

I can't really write a test for this, so it's kind of a best effort deal.

What this PR does / why we need it:
This returns a non-zero exit code for sonobuoy status when the status is that a plugin has failed.

Which issue(s) this PR fixes

Special notes for your reviewer:

Release note:

NONE

Fixes vmware-tanzu#404

Signed-off-by: Chuck Ha <chuck@heptio.com>
@chuckha chuckha requested review from timothysc and liztio July 3, 2018 21:43

func exitCode(status *aggregation.Status) int {
switch status.Status {
case aggregation.FailedStatus:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not an error on GetStatus?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's not an error getting the status -- the error is on the plugin and is reported through the status.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, that name aggregation.FailedStatus is super generic.

Do you have an example of this failure w/exit 1?

What does it look like to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an example, but it will look like this (hand crafted output):

test salazar:sonobuoy cha$ sonobuoy status
PLUGIN		STATUS		COUNT
e2e		complete	1
systemd_logs	failed	1

Sonobuoy has failed. You can see what happened with `sonobuoy logs`.

test salazar:sonobuoy cha$ echo $?
1

Copy link
Contributor

@timothysc timothysc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm but may refactor some of the handling l8r.

@timothysc timothysc merged commit 87cf469 into vmware-tanzu:master Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get non-zero exit code from sonnobuoy cli in case of returned failed status
2 participants