mirror of https://github.com/containers/podman.git
Ignore spurious container-removal errors
When removing a container's dependency, getting an error that the container has already been removed (ErrNoSuchCtr and ErrCtrRemoved) should not be fatal. We wanted the container gone, it's gone, no need to error out. [NO NEW TESTS NEEDED] This is a race and thus hard to test for. Fixes #18874 Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
parent
0e3b492faa
commit
71549c642f
|
@ -916,12 +916,16 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, opts ctrRmO
|
||||||
}
|
}
|
||||||
ctrs, pods, err := r.removeContainer(ctx, dep, recursiveOpts)
|
ctrs, pods, err := r.removeContainer(ctx, dep, recursiveOpts)
|
||||||
for rmCtr, err := range ctrs {
|
for rmCtr, err := range ctrs {
|
||||||
removedCtrs[rmCtr] = err
|
if errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved) {
|
||||||
|
removedCtrs[rmCtr] = nil
|
||||||
|
} else {
|
||||||
|
removedCtrs[rmCtr] = err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for rmPod, err := range pods {
|
for rmPod, err := range pods {
|
||||||
removedPods[rmPod] = err
|
removedPods[rmPod] = err
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil && !errors.Is(err, define.ErrNoSuchCtr) && !errors.Is(err, define.ErrCtrRemoved) {
|
||||||
retErr = err
|
retErr = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue