mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00
libpod: do not save expected stop errors in ctr state
If we try to stop a contianer that is not running or paused we get an ErrCtrStateInvalid or ErrCtrStopped error. As podman stop is idempotent this is not a user visable error at all so we should also never log it in the container state. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -263,7 +263,11 @@ func (c *Container) StopWithTimeout(timeout uint) (finalErr error) {
|
||||
// defer's are executed LIFO so we are locked here
|
||||
// as long as we call this after the defer unlock()
|
||||
defer func() {
|
||||
if finalErr != nil {
|
||||
// The podman stop command is idempotent while the internal function here is not.
|
||||
// As such we do not want to log these errors in the state because they are not
|
||||
// actually user visible errors.
|
||||
if finalErr != nil && !errors.Is(finalErr, define.ErrCtrStopped) &&
|
||||
!errors.Is(finalErr, define.ErrCtrStateInvalid) {
|
||||
if err := saveContainerError(c, finalErr); err != nil {
|
||||
logrus.Debug(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user