mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Merge pull request #10371 from matejvasek/fix-wait-compat
fix: response of containers wait endpoint
This commit is contained in:
@ -98,7 +98,7 @@ type BuildResult struct {
|
||||
|
||||
type ContainerWaitOKBody struct {
|
||||
StatusCode int
|
||||
Error struct {
|
||||
Error *struct {
|
||||
Message string
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
responseData := handlers.ContainerWaitOKBody{
|
||||
StatusCode: int(exitCode),
|
||||
Error: struct {
|
||||
errStruct = &struct {
|
||||
Message string
|
||||
}{
|
||||
Message: msg,
|
||||
},
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
|
||||
responseData := handlers.ContainerWaitOKBody{
|
||||
StatusCode: int(exitCode),
|
||||
Error: errStruct,
|
||||
}
|
||||
enc := json.NewEncoder(w)
|
||||
enc.SetEscapeHTML(true)
|
||||
|
Reference in New Issue
Block a user