summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-19 07:52:58 -0400
committerGitHub <noreply@github.com>2021-05-19 07:52:58 -0400
commit18efc5a3a78ba7352e42517ba251212833b4583d (patch)
tree57605396a38a648944fe7b3da76e623a5694cc74 /pkg
parent40025895461cb9b3b22f0f7cbe92ccad75ad637c (diff)
parent92e858914d1a3515ffa1017c5adaad3ef5d89f5b (diff)
downloadpodman-18efc5a3a78ba7352e42517ba251212833b4583d.tar.gz
podman-18efc5a3a78ba7352e42517ba251212833b4583d.tar.bz2
podman-18efc5a3a78ba7352e42517ba251212833b4583d.zip
Merge pull request #10371 from matejvasek/fix-wait-compat
fix: response of containers wait endpoint
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/types.go2
-rw-r--r--pkg/api/handlers/utils/containers.go15
2 files changed, 9 insertions, 8 deletions
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index 52d7633af..2ffd9b0cb 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -98,7 +98,7 @@ type BuildResult struct {
type ContainerWaitOKBody struct {
StatusCode int
- Error struct {
+ Error *struct {
Message string
}
}
diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go
index 6c708f74e..fb1f8b7c1 100644
--- a/pkg/api/handlers/utils/containers.go
+++ b/pkg/api/handlers/utils/containers.go
@@ -75,18 +75,19 @@ func WaitContainerDocker(w http.ResponseWriter, r *http.Request) {
}
exitCode, err := waitDockerCondition(ctx, name, interval, condition)
- msg := ""
+ var errStruct *struct{ Message string }
if err != nil {
logrus.Errorf("error while waiting on condition: %q", err)
- msg = err.Error()
+ errStruct = &struct {
+ Message string
+ }{
+ Message: err.Error(),
+ }
}
+
responseData := handlers.ContainerWaitOKBody{
StatusCode: int(exitCode),
- Error: struct {
- Message string
- }{
- Message: msg,
- },
+ Error: errStruct,
}
enc := json.NewEncoder(w)
enc.SetEscapeHTML(true)