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

Reverse the exitcode initialization value #278

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eds-collabora
Copy link

No description provided.

cmd/debos/debos.go Outdated Show resolved Hide resolved
cmd/debos/debos.go Show resolved Hide resolved
@eds-collabora
Copy link
Author

eds-collabora commented Aug 9, 2021

Summary of comments on this code to date:

@eds-collabora eds-collabora marked this pull request as ready for review August 11, 2021 17:35
@evelikov
Copy link

evelikov commented Aug 11, 2021

In case it matters, the PR is:
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

If it were me, I would squash all the patches, adding a small note at the bottom for the extra changes wrt the original. Not a huge deal either way. Example:

...
This commit reverses the logic of the exitcode: it is initialized to 1
(i.e. failure), and it is set to 0 (i.e. success) only if Debos has
reached the end of the things it has to do (or for the help message).

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>

[Ed Smith]
 - Merge lines …
 - Fix exit behaviour when using fakemachine …
Signed-off-by: ... < if the project needs it, not sure

Edit: and you've done it already, but the time I wrote this. Nice

@evelikov
Copy link

Btw would be nice to hear from @sjoerdsimons what testing he had in plan in the earlier PR #198.

Perhaps even close the old/superseded PR.

@obbardc
Copy link
Member

obbardc commented Aug 13, 2021

Btw would be nice to hear from @sjoerdsimons what testing he had in plan in the earlier PR #198.

the comment was:

testing of the various failure and test cases and with both kvm and non-fakemachine runs

tests/exit_test/bad.yaml Outdated Show resolved Hide resolved
tests/exit_test/bad.yaml Outdated Show resolved Hide resolved
tests/exit_test/good.yaml Outdated Show resolved Hide resolved
tests/exit_test/good.yaml Outdated Show resolved Hide resolved
@eds-collabora eds-collabora force-pushed the eds/exitcode_fix2 branch 2 times, most recently from 50c408c to b8c84eb Compare August 16, 2021 14:47
@evelikov
Copy link

evelikov commented Sep 9, 2021

With a bunch of tests in place (thanks Ed), can we get this trivial PR merged?

@obbardc
Copy link
Member

obbardc commented Jan 7, 2022

I took another look at this and wasn't happy; decided it would be cleaner to rework the panics in the code to bubbled-up errors: go-debos/fakemachine#74

gportay and others added 3 commits December 31, 2023 13:19
Fakemachine is subject to panic and causes Debos to exit success due to
the current logic of the exitcode. For example, the fakemachine function
CopyFileTo() panics if the file is missing.

In the case of a panic, the function never returns. Thus, the exitcode
cannot be set to 1 and Debos exits with 0.

This commit reverses the logic of the exitcode: it is initialized to 1
(i.e. failure), and it is set to 0 (i.e. success) only if Debos has
reached the end of the things it has to do (or for the help message).

Co-authored-by: Gaël PORTAY <gael.portay@collabora.com>
Co-authored-by: Santosh Mahto <santosh.mahto@collabora.com>

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
@sjoerdsimons
Copy link
Member

@obbardc would probably be worth picking up the tests that were added here even if you ended up doing the error handlign improvements in another way?

@obbardc
Copy link
Member

obbardc commented Jan 15, 2024

@obbardc would probably be worth picking up the tests that were added here even if you ended up doing the error handlign improvements in another way?

Yeah, I will pick the tests up from this PR and cherry pick onto !303. Once that is done I will close this PR.

@obbardc obbardc marked this pull request as draft January 15, 2024 10:44
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.

None yet

5 participants