-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add container error message to ContainerState #16806
Add container error message to ContainerState #16806
Conversation
I still need to figure out the best way to test all of the different ways an error could be saved to the I also need to verify that everywhere I have |
9920290
to
80887fc
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.
It's probably easier to return a named error and use a defer
to save the error. For instance
defer func() {
if finalErr != nil {
saveContainerError(...)
}
}()
Any chance we move saving the error further up the call stack? The higher we are, the less locations we have to update (and will probably miss in the future).
@mheon PTAL
I definitely agree the named error would be easier. The issue I was having with the location of the error being saved came down to the container API. To the best of my knowledge, I don't actually get access to the container state until this point in the call stack, unless I was to modify the container API (which I tried to avoid). I accept the fact there's a good chance I'm wrong, though. |
I'm OK with leaving the error where it is... Moving out of Libpod is just going to start introducing substantial complexity (having the ability to update the DB outside of libpod is problematic). |
775fc9c
to
c5a5d09
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.
Changes LGTM.
Note that the diff would be even smaller when calling the named error finalError
or something that is not yet used in the function bodies. Than, they can continue to return err
.
@mheon PTAL
d195045
to
e9209c9
Compare
All kinds of red unhappy tests |
e9209c9
to
03bc0c8
Compare
Is it possible to restart the tests? Looks like some unrelated failure with a missing catatonit executable |
defer func() { | ||
if finalErr != nil { | ||
_ = saveContainerError(c, finalErr) | ||
} |
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.
Can you logrus.Debug this error if not nil?
libpod/container_api.go
Outdated
func (c *Container) StartAndAttach(ctx context.Context, streams *define.AttachStreams, keys string, resize <-chan resize.TerminalSize, recursive bool) (retChan <-chan error, finalErr error) { | ||
defer func() { | ||
if finalErr != nil { | ||
_ = saveContainerError(c, finalErr) |
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.
Can you logrus.Debug this error if not nil?
libpod/container_api.go
Outdated
func (c *Container) StopWithTimeout(timeout uint) (finalErr error) { | ||
defer func() { | ||
if finalErr != nil { | ||
_ = saveContainerError(c, finalErr) |
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.
Can you logrus.Debug this error if not nil?
This change aims to store an error message to the ContainerState struct with the last known error from the Start, StartAndAttach, and Stop OCI Runtime functions. The goal was to act in accordance with Docker's behavior. Fixes: containers#13729 Signed-off-by: Jake Correnti <[email protected]>
03bc0c8
to
df02cb5
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jakecorrenti, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
This change aims to store an error message to the
ContainerState
struct with the last known error from theStart
,StartAndAttach
, andStop
OCI Runtime functions.The goal was to act in accordance with Docker's behavior.
Example:
Fixes: #13729
Signed-off-by: Jake Correnti [email protected]
Does this PR introduce a user-facing change?