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
core: add missing error type check to exec #8751
core: add missing error type check to exec #8751
Conversation
@leseb I'm not sure how you were testing this before, but I'm pretty sure this will fix the issue. I'm going to add unit tests to be more sure of it, but it would be good to be able to run the real life test manually to be sure. |
TODO:
|
I swear I had tested that too and each time I was not able to enter the right |
0326aa1
to
a08545d
Compare
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.
I'm not sure if this will fix the issue but better coverage is nice. Thanks!
@Mergifyio rebase |
Command
|
a08545d
to
4a0423d
Compare
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.
nit and 1 question
pkg/util/exec/exec.go
Outdated
if strings.Contains(err.Error(), "command terminated with exit code") { | ||
a := strings.SplitAfter(err.Error(), "command terminated with exit code") | ||
return strconv.Atoi(strings.TrimSpace(a[1])) | ||
} | ||
return 0, errors.Errorf("error %#v is not an ExitError nor CodeExitError but is %v", err, reflect.TypeOf(err)) | ||
return 0, errors.Errorf("error %#v is an unknown error type: %v", err, reflect.TypeOf(err)) |
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.
Afterthoughts, should we return something else than 0
if we return an unknown error?
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.
I had a similar thought. Let me do that.
9351bff
to
d449828
Compare
In ExtractExitCode, there is one error type that can be valid as a pointer or not-as-a-pointer. Add a case to the type check for the non-pointer condition. Resolves rook#8280 Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
d449828
to
bc494f5
Compare
@BlaineEXE is the DNM label still relevant? |
core: add missing error type check to exec (backport #8751)
In ExtractExitCode, there is one error type that can be valid as a
pointer or not-as-a-pointer. Add a case to the type check for the
non-pointer condition.
Resolves #8280
Signed-off-by: Blaine Gardner blaine.gardner@redhat.com
Description of your changes:
Which issue is resolved by this Pull Request:
Resolves #
Checklist:
make codegen
) has been run to update object specifications, if necessary.