aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/pods.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-24 18:35:59 -0400
committerGitHub <noreply@github.com>2020-08-24 18:35:59 -0400
commit024f47068a894907ee47b1b90c86090a00586940 (patch)
tree4528b3566c3162ca2892b8c3d752d3957161e3d5 /pkg/api/handlers/libpod/pods.go
parentc78c6b44ce63430218e141415a10b2010d42f883 (diff)
parent13d5b2d661478005a0b7eec5563d13580b6cd3f8 (diff)
downloadpodman-024f47068a894907ee47b1b90c86090a00586940.tar.gz
podman-024f47068a894907ee47b1b90c86090a00586940.tar.bz2
podman-024f47068a894907ee47b1b90c86090a00586940.zip
Merge pull request #7402 from mheon/last_pr_before_205_really_this_time
Final v2.0.5 backports
Diffstat (limited to 'pkg/api/handlers/libpod/pods.go')
-rw-r--r--pkg/api/handlers/libpod/pods.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go
index dee5a7d33..7e3f00472 100644
--- a/pkg/api/handlers/libpod/pods.go
+++ b/pkg/api/handlers/libpod/pods.go
@@ -123,10 +123,17 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
} else {
responses, stopError = pod.Stop(r.Context(), false)
}
- if stopError != nil {
+ if stopError != nil && errors.Cause(stopError) != define.ErrPodPartialFail {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
+ // Try to clean up the pod - but only warn on failure, it's nonfatal.
+ if cleanupCtrs, cleanupErr := pod.Cleanup(r.Context()); cleanupErr != nil {
+ logrus.Errorf("Error cleaning up pod %s: %v", pod.ID(), cleanupErr)
+ for id, err := range cleanupCtrs {
+ logrus.Errorf("Error cleaning up pod %s container %s: %v", pod.ID(), id, err)
+ }
+ }
var errs []error //nolint
for _, err := range responses {
errs = append(errs, err)