Merge pull request #1217 from snir911/fix_hanging_pods

shimv2: Avoid double removing of container from sandbox
This commit is contained in:
Fabiano Fidêncio 2021-01-08 15:00:54 +01:00 committed by GitHub
commit ce27c00ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,13 +17,12 @@ import (
func deleteContainer(ctx context.Context, s *service, c *container) error { func deleteContainer(ctx context.Context, s *service, c *container) error {
if !c.cType.IsSandbox() { if !c.cType.IsSandbox() {
if c.status != task.StatusStopped { if c.status != task.StatusStopped {
_, err := s.sandbox.StopContainer(c.id, false) if _, err := s.sandbox.StopContainer(c.id, false); err != nil && !isNotFound(err) {
if err != nil {
return err return err
} }
} }
if _, err := s.sandbox.DeleteContainer(c.id); err != nil { if _, err := s.sandbox.DeleteContainer(c.id); err != nil && !isNotFound(err) {
return err return err
} }
} }