Skip to content

Commit

Permalink
Merge pull request containers#11787 from rhatdan/deleteContainer
Browse files Browse the repository at this point in the history
Storage can remove ErrNotAContainer as well
  • Loading branch information
openshift-merge-robot authored Sep 30, 2021
2 parents b187dfe + c9ea2ca commit 39d27cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libpod/runtime_cstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
}

if err := r.store.DeleteContainer(ctr.ID); err != nil {
if errors.Cause(err) == storage.ErrContainerUnknown {
if errors.Cause(err) == storage.ErrNotAContainer || errors.Cause(err) == storage.ErrContainerUnknown {
// Container again gone, no error
logrus.Infof("Storage for container %s already removed", ctr.ID)
return nil
Expand Down
8 changes: 6 additions & 2 deletions libpod/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ func (r *storageService) DeleteContainer(idOrName string) error {
}
err = r.store.DeleteContainer(container.ID)
if err != nil {
logrus.Debugf("Failed to delete container %q: %v", container.ID, err)
return err
if errors.Cause(err) == storage.ErrNotAContainer || errors.Cause(err) == storage.ErrContainerUnknown {
logrus.Infof("Storage for container %s already removed", container.ID)
} else {
logrus.Debugf("Failed to delete container %q: %v", container.ID, err)
return err
}
}
return nil
}
Expand Down

0 comments on commit 39d27cc

Please sign in to comment.