mirror of
https://github.com/containers/podman.git
synced 2025-09-10 15:46:07 +08:00
Merge pull request #10427 from rhatdan/errors
Drop container does not exist on removal to debugf
This commit is contained in:
@ -275,7 +275,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
|
|||||||
case nil:
|
case nil:
|
||||||
// remove container names that we successfully deleted
|
// remove container names that we successfully deleted
|
||||||
reports = append(reports, &report)
|
reports = append(reports, &report)
|
||||||
case define.ErrNoSuchCtr:
|
case define.ErrNoSuchCtr, define.ErrCtrExists:
|
||||||
// There is still a potential this is a libpod container
|
// There is still a potential this is a libpod container
|
||||||
tmpNames = append(tmpNames, ctr)
|
tmpNames = append(tmpNames, ctr)
|
||||||
default:
|
default:
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"github.com/containers/podman/v3/pkg/errorhandling"
|
"github.com/containers/podman/v3/pkg/errorhandling"
|
||||||
"github.com/containers/podman/v3/pkg/specgen"
|
"github.com/containers/podman/v3/pkg/specgen"
|
||||||
"github.com/containers/podman/v3/pkg/util"
|
"github.com/containers/podman/v3/pkg/util"
|
||||||
|
"github.com/containers/storage/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -580,7 +581,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
|||||||
if err := containers.Remove(ic.ClientCtx, ctr.ID, removeOptions); err != nil {
|
if err := containers.Remove(ic.ClientCtx, ctr.ID, removeOptions); err != nil {
|
||||||
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
|
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
|
||||||
errorhandling.Contains(err, define.ErrCtrRemoved) {
|
errorhandling.Contains(err, define.ErrCtrRemoved) {
|
||||||
logrus.Warnf("Container %s does not exist: %v", ctr.ID, err)
|
logrus.Debugf("Container %s does not exist: %v", ctr.ID, err)
|
||||||
} else {
|
} else {
|
||||||
logrus.Errorf("Error removing container %s: %v", ctr.ID, err)
|
logrus.Errorf("Error removing container %s: %v", ctr.ID, err)
|
||||||
}
|
}
|
||||||
@ -613,8 +614,9 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
|||||||
rmOptions := new(containers.RemoveOptions).WithForce(false).WithVolumes(true)
|
rmOptions := new(containers.RemoveOptions).WithForce(false).WithVolumes(true)
|
||||||
if err := containers.Remove(ic.ClientCtx, ctr.ID, rmOptions); err != nil {
|
if err := containers.Remove(ic.ClientCtx, ctr.ID, rmOptions); err != nil {
|
||||||
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
|
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
|
||||||
errorhandling.Contains(err, define.ErrCtrRemoved) {
|
errorhandling.Contains(err, define.ErrCtrRemoved) ||
|
||||||
logrus.Warnf("Container %s does not exist: %v", ctr.ID, err)
|
errorhandling.Contains(err, types.ErrLayerUnknown) {
|
||||||
|
logrus.Debugf("Container %s does not exist: %v", ctr.ID, err)
|
||||||
} else {
|
} else {
|
||||||
logrus.Errorf("Error removing container %s: %v", ctr.ID, err)
|
logrus.Errorf("Error removing container %s: %v", ctr.ID, err)
|
||||||
}
|
}
|
||||||
@ -691,8 +693,9 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
|
|||||||
if !shouldRestart {
|
if !shouldRestart {
|
||||||
if err := containers.Remove(ic.ClientCtx, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); err != nil {
|
if err := containers.Remove(ic.ClientCtx, con.ID, new(containers.RemoveOptions).WithForce(false).WithVolumes(true)); err != nil {
|
||||||
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
|
if errorhandling.Contains(err, define.ErrNoSuchCtr) ||
|
||||||
errorhandling.Contains(err, define.ErrCtrRemoved) {
|
errorhandling.Contains(err, define.ErrCtrRemoved) ||
|
||||||
logrus.Warnf("Container %s does not exist: %v", con.ID, err)
|
errorhandling.Contains(err, types.ErrLayerUnknown) {
|
||||||
|
logrus.Debugf("Container %s does not exist: %v", con.ID, err)
|
||||||
} else {
|
} else {
|
||||||
logrus.Errorf("Error removing container %s: %v", con.ID, err)
|
logrus.Errorf("Error removing container %s: %v", con.ID, err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user