From 7f88deff1ecc751cd087ac220eb48204cd442c64 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 13 Oct 2022 12:22:34 +0200 Subject: [PATCH] KillContainer: improve error message To improve the error message reported in #16142 where the container is reported to be in the wrong state but we do not know which. This is not a fix for #16142 but will hopefully aid in better understanding what's going on if it flakes again. [NO NEW TESTS NEEDED] as hitting the condition is inherently racy. Signed-off-by: Valentin Rothberg --- libpod/oci_conmon_common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index ab0c8aabe8..157cbe2598 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -376,7 +376,7 @@ func (r *ConmonOCIRuntime) KillContainer(ctr *Container, signal uint, all bool) logrus.Infof("Error updating status for container %s: %v", ctr.ID(), err2) } if ctr.ensureState(define.ContainerStateStopped, define.ContainerStateExited) { - return define.ErrCtrStateInvalid + return fmt.Errorf("%w: %s", define.ErrCtrStateInvalid, ctr.state.State) } return fmt.Errorf("sending signal to container %s: %w", ctr.ID(), err) }