summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/compat/containers.go13
-rw-r--r--pkg/api/handlers/compat/images_build.go2
-rw-r--r--pkg/api/handlers/swagger/swagger.go7
-rw-r--r--pkg/api/handlers/types.go11
-rw-r--r--pkg/api/server/register_containers.go17
5 files changed, 44 insertions, 6 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index ad341c3ab..4539199d3 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -36,6 +36,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
query := struct {
Force bool `schema:"force"`
Ignore bool `schema:"ignore"`
+ Depend bool `schema:"depend"`
Link bool `schema:"link"`
Timeout *uint `schema:"timeout"`
DockerVolumes bool `schema:"v"`
@@ -57,6 +58,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
if utils.IsLibpodRequest(r) {
options.Volumes = query.LibpodVolumes
options.Timeout = query.Timeout
+ options.Depend = query.Depend
} else {
if query.Link {
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
@@ -71,7 +73,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
// code.
containerEngine := abi.ContainerEngine{Libpod: runtime}
name := utils.GetName(r)
- report, err := containerEngine.ContainerRm(r.Context(), []string{name}, options)
+ reports, err := containerEngine.ContainerRm(r.Context(), []string{name}, options)
if err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr {
utils.ContainerNotFound(w, name, err)
@@ -81,8 +83,8 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
- if len(report) > 0 && report[0].Err != nil {
- err = report[0].Err
+ if len(reports) > 0 && reports[0].Err != nil {
+ err = reports[0].Err
if errors.Cause(err) == define.ErrNoSuchCtr {
utils.ContainerNotFound(w, name, err)
return
@@ -90,7 +92,10 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
utils.InternalServerError(w, err)
return
}
-
+ if utils.IsLibpodRequest(r) {
+ utils.WriteResponse(w, http.StatusOK, reports)
+ return
+ }
utils.WriteResponse(w, http.StatusNoContent, nil)
}
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 0fcac5330..2d296b5ce 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -138,7 +138,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
// if layers field not set assume its not from a valid podman-client
// could be a docker client, set `layers=true` since that is the default
- // expected behviour
+ // expected behaviour
if !utils.IsLibpodRequest(r) {
if _, found := r.URL.Query()["layers"]; !found {
query.Layers = true
diff --git a/pkg/api/handlers/swagger/swagger.go b/pkg/api/handlers/swagger/swagger.go
index 9844839b7..7868ff206 100644
--- a/pkg/api/handlers/swagger/swagger.go
+++ b/pkg/api/handlers/swagger/swagger.go
@@ -111,6 +111,13 @@ type swagLibpodInspectImageResponse struct {
}
}
+// Rm containers
+// swagger:response DocsLibpodContainerRmReport
+type swagLibpodContainerRmReport struct {
+ // in: body
+ Body []handlers.LibpodContainersRmReport
+}
+
// Prune containers
// swagger:response DocsContainerPruneReport
type swagContainerPruneReport struct {
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index f850db3d8..588758b2c 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -53,6 +53,17 @@ type LibpodContainersPruneReport struct {
PruneError string `json:"Err,omitempty"`
}
+type LibpodContainersRmReport struct {
+ ID string `json:"Id"`
+ // Error which occurred during Rm operation (if any).
+ // This field is optional and may be omitted if no error occurred.
+ //
+ // Extensions:
+ // x-omitempty: true
+ // x-nullable: true
+ RmError string `json:"Err,omitempty"`
+}
+
type Info struct {
docker.Info
BuildahVersion string
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index 601e1251b..4d19c04d4 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -817,9 +817,22 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// required: true
// description: the name or ID of the container
// - in: query
+ // name: depend
+ // type: boolean
+ // description: additionally remove containers that depend on the container to be removed
+ // - in: query
// name: force
// type: boolean
- // description: need something
+ // description: force stop container if running
+ // - in: query
+ // name: ignore
+ // type: boolean
+ // description: ignore errors when the container to be removed does not existxo
+ // - in: query
+ // name: timeout
+ // type: integer
+ // default: 10
+ // description: number of seconds to wait before killing container when force removing
// - in: query
// name: v
// type: boolean
@@ -827,6 +840,8 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// produces:
// - application/json
// responses:
+ // 200:
+ // $ref: "#/responses/DocsLibpodContainerRmReport"
// 204:
// description: no error
// 400: