Skip to content

Commit

Permalink
Merge pull request #8584 from jwhonce/jira/RUN-1106-containers
Browse files Browse the repository at this point in the history
Jira RUN-1106 Container handlers updates
  • Loading branch information
openshift-merge-robot authored Dec 4, 2020
2 parents ec0411a + 767afe0 commit a2d536e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
7 changes: 5 additions & 2 deletions pkg/api/handlers/compat/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
"github.com/gorilla/mux"
"github.com/gorilla/schema"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -73,7 +74,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}

func ListContainers(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -207,16 +208,18 @@ func KillContainer(w http.ResponseWriter, r *http.Request) {
}
}
// Success
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}

func WaitContainer(w http.ResponseWriter, r *http.Request) {
var msg string
// /{version}/containers/(name)/wait
exitCode, err := utils.WaitContainer(w, r)
if err != nil {
logrus.Warnf("failed to wait on container %q: %v", mux.Vars(r)["name"], err)
return
}

utils.WriteResponse(w, http.StatusOK, handlers.ContainerWaitOKBody{
StatusCode: int(exitCode),
Error: struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/handlers/compat/containers_pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ func PauseContainer(w http.ResponseWriter, r *http.Request) {
return
}
// Success
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}
2 changes: 1 addition & 1 deletion pkg/api/handlers/compat/containers_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func RestartContainer(w http.ResponseWriter, r *http.Request) {
}

// Success
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}
4 changes: 2 additions & 2 deletions pkg/api/handlers/compat/containers_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func StartContainer(w http.ResponseWriter, r *http.Request) {
return
}
if state == define.ContainerStateRunning {
utils.WriteResponse(w, http.StatusNotModified, "")
utils.WriteResponse(w, http.StatusNotModified, nil)
return
}
if err := con.Start(r.Context(), len(con.PodID()) > 0); err != nil {
utils.InternalServerError(w, err)
return
}
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}
4 changes: 2 additions & 2 deletions pkg/api/handlers/compat/containers_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func StopContainer(w http.ResponseWriter, r *http.Request) {
}
// If the Container is stopped already, send a 304
if state == define.ContainerStateStopped || state == define.ContainerStateExited {
utils.WriteResponse(w, http.StatusNotModified, "")
utils.WriteResponse(w, http.StatusNotModified, nil)
return
}

Expand All @@ -56,5 +56,5 @@ func StopContainer(w http.ResponseWriter, r *http.Request) {
}

// Success
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}
2 changes: 1 addition & 1 deletion pkg/api/handlers/compat/containers_unpause.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ func UnpauseContainer(w http.ResponseWriter, r *http.Request) {
}

// Success
utils.WriteResponse(w, http.StatusNoContent, "")
utils.WriteResponse(w, http.StatusNoContent, nil)
}

0 comments on commit a2d536e

Please sign in to comment.