@@ -25,18 +25,17 @@ import (
2525 containerdio "github.com/containerd/containerd/cio"
2626 "github.com/containerd/containerd/errdefs"
2727 "github.com/containerd/containerd/events"
28+ "github.com/containerd/containerd/pkg/cri/constants"
29+ containerstore "github.com/containerd/containerd/pkg/cri/store/container"
30+ sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
31+ ctrdutil "github.com/containerd/containerd/pkg/cri/util"
2832 "github.com/containerd/typeurl"
33+
2934 gogotypes "github.com/gogo/protobuf/types"
3035 "github.com/pkg/errors"
3136 "github.com/sirupsen/logrus"
3237 "golang.org/x/net/context"
3338 "k8s.io/apimachinery/pkg/util/clock"
34-
35- "github.com/containerd/containerd/pkg/cri/constants"
36- "github.com/containerd/containerd/pkg/cri/store"
37- containerstore "github.com/containerd/containerd/pkg/cri/store/container"
38- sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
39- ctrdutil "github.com/containerd/containerd/pkg/cri/util"
4039)
4140
4241const (
@@ -141,7 +140,7 @@ func (em *eventMonitor) startSandboxExitMonitor(ctx context.Context, id string,
141140 return err
142141 }
143142 return nil
144- } else if err != store . ErrNotExist {
143+ } else if ! errdefs . IsNotFound ( err ) {
145144 return errors .Wrapf (err , "failed to get sandbox %s" , e .ID )
146145 }
147146 return nil
@@ -192,7 +191,7 @@ func (em *eventMonitor) startContainerExitMonitor(ctx context.Context, id string
192191 return err
193192 }
194193 return nil
195- } else if err != store . ErrNotExist {
194+ } else if ! errdefs . IsNotFound ( err ) {
196195 return errors .Wrapf (err , "failed to get container %s" , e .ID )
197196 }
198197 return nil
@@ -318,7 +317,7 @@ func (em *eventMonitor) handleEvent(any interface{}) error {
318317 return errors .Wrap (err , "failed to handle container TaskExit event" )
319318 }
320319 return nil
321- } else if err != store . ErrNotExist {
320+ } else if ! errdefs . IsNotFound ( err ) {
322321 return errors .Wrap (err , "can't find container for TaskExit event" )
323322 }
324323 sb , err := em .c .sandboxStore .Get (e .ID )
@@ -327,7 +326,7 @@ func (em *eventMonitor) handleEvent(any interface{}) error {
327326 return errors .Wrap (err , "failed to handle sandbox TaskExit event" )
328327 }
329328 return nil
330- } else if err != store . ErrNotExist {
329+ } else if ! errdefs . IsNotFound ( err ) {
331330 return errors .Wrap (err , "can't find sandbox for TaskExit event" )
332331 }
333332 return nil
@@ -336,7 +335,7 @@ func (em *eventMonitor) handleEvent(any interface{}) error {
336335 // For TaskOOM, we only care which container it belongs to.
337336 cntr , err := em .c .containerStore .Get (e .ContainerID )
338337 if err != nil {
339- if err != store . ErrNotExist {
338+ if ! errdefs . IsNotFound ( err ) {
340339 return errors .Wrap (err , "can't find container for TaskOOM event" )
341340 }
342341 return nil
0 commit comments