sandbox: ignore not found error when remove sandbox
Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
parent
2951fb6dc6
commit
0707f68690
@ -23,6 +23,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/protobuf/types"
|
"github.com/containerd/containerd/protobuf/types"
|
||||||
api "github.com/containerd/containerd/sandbox"
|
api "github.com/containerd/containerd/sandbox"
|
||||||
@ -118,11 +119,11 @@ func (s *sandboxClient) Stop(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *sandboxClient) Shutdown(ctx context.Context) error {
|
func (s *sandboxClient) Shutdown(ctx context.Context) error {
|
||||||
if err := s.client.SandboxController(s.metadata.Sandboxer).Shutdown(ctx, s.ID()); err != nil {
|
if err := s.client.SandboxController(s.metadata.Sandboxer).Shutdown(ctx, s.ID()); err != nil && errdefs.IsNotFound(err) {
|
||||||
return fmt.Errorf("failed to shutdown sandbox: %w", err)
|
return fmt.Errorf("failed to shutdown sandbox: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.client.SandboxStore().Delete(ctx, s.ID()); err != nil {
|
if err := s.client.SandboxStore().Delete(ctx, s.ID()); err != nil && !errdefs.IsNotFound(err) {
|
||||||
return fmt.Errorf("failed to delete sandbox from store: %w", err)
|
return fmt.Errorf("failed to delete sandbox from store: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user