mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-24 22:43:05 +00:00
shimv2: Avoid double removing of container from sandbox
RemoveContainerRequest results in calling to deleteContainer, according to spec calling to RemoveContainer is idempotent and "must not return an error if the container has already been removed", hence, don't return error if the error reports that the container is not found. Fixes: #836 Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
This commit is contained in:
parent
f1b3f2e178
commit
5c464018ed
@ -17,13 +17,12 @@ import (
|
||||
func deleteContainer(ctx context.Context, s *service, c *container) error {
|
||||
if !c.cType.IsSandbox() {
|
||||
if c.status != task.StatusStopped {
|
||||
_, err := s.sandbox.StopContainer(c.id, false)
|
||||
if err != nil {
|
||||
if _, err := s.sandbox.StopContainer(c.id, false); err != nil && !isNotFound(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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user