summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-28 09:59:37 -0400
committerGitHub <noreply@github.com>2020-08-28 09:59:37 -0400
commit0640cc79210419e8a72b6a07a7a3ffcae9e97367 (patch)
tree373f2e7ea591d4f255a323319e5df3a5e509c39f /pkg
parente3edb7ba9dd8d079b09d2effda365a1b51d303e7 (diff)
parent580c39fea8f1053934a533ad34ed159db3c906cb (diff)
downloadpodman-0640cc79210419e8a72b6a07a7a3ffcae9e97367.tar.gz
podman-0640cc79210419e8a72b6a07a7a3ffcae9e97367.tar.bz2
podman-0640cc79210419e8a72b6a07a7a3ffcae9e97367.zip
Merge pull request #7428 from mheon/apiv2_container_pod_errors
Ensure pod REST API endpoints include ctr errors
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/libpod/pods.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go
index 6e704fe65..8f8292567 100644
--- a/pkg/api/handlers/libpod/pods.go
+++ b/pkg/api/handlers/libpod/pods.go
@@ -135,8 +135,8 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
}
}
var errs []error //nolint
- for _, err := range responses {
- errs = append(errs, err)
+ for id, err := range responses {
+ errs = append(errs, errors.Wrapf(err, "error stopping container %s", id))
}
report := entities.PodStopReport{
Errs: errs,
@@ -164,12 +164,12 @@ func PodStart(w http.ResponseWriter, r *http.Request) {
return
}
responses, err := pod.Start(r.Context())
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
- for _, err := range responses {
- errs = append(errs, err)
+ for id, err := range responses {
+ errs = append(errs, errors.Wrapf(err, "error starting container %s", id))
}
report := entities.PodStartReport{
Errs: errs,
@@ -220,12 +220,12 @@ func PodRestart(w http.ResponseWriter, r *http.Request) {
return
}
responses, err := pod.Restart(r.Context())
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
- for _, err := range responses {
- errs = append(errs, err)
+ for id, err := range responses {
+ errs = append(errs, errors.Wrapf(err, "error restarting container %s", id))
}
report := entities.PodRestartReport{
Errs: errs,
@@ -271,12 +271,12 @@ func PodPause(w http.ResponseWriter, r *http.Request) {
return
}
responses, err := pod.Pause()
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
return
}
- for _, v := range responses {
- errs = append(errs, v)
+ for id, v := range responses {
+ errs = append(errs, errors.Wrapf(v, "error pausing container %s", id))
}
report := entities.PodPauseReport{
Errs: errs,
@@ -295,12 +295,12 @@ func PodUnpause(w http.ResponseWriter, r *http.Request) {
return
}
responses, err := pod.Unpause()
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
utils.Error(w, "failed to pause pod", http.StatusInternalServerError, err)
return
}
- for _, v := range responses {
- errs = append(errs, v)
+ for id, v := range responses {
+ errs = append(errs, errors.Wrapf(v, "error unpausing container %s", id))
}
report := entities.PodUnpauseReport{
Errs: errs,
@@ -403,7 +403,7 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
}
responses, err := pod.Kill(uint(sig))
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
utils.Error(w, "failed to kill pod", http.StatusInternalServerError, err)
return
}