diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-09-30 14:43:39 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-10-04 07:07:56 -0400 |
commit | 21c9dc3c406bb486c44c4a27e5b0497bab1cd40d (patch) | |
tree | 56793ffd885f835fa54013e9914844ff9ba20d92 /pkg/api/handlers/compat | |
parent | 36821d302e3787a42d6eefdbd0bdbb6d9da261fb (diff) | |
download | podman-21c9dc3c406bb486c44c4a27e5b0497bab1cd40d.tar.gz podman-21c9dc3c406bb486c44c4a27e5b0497bab1cd40d.tar.bz2 podman-21c9dc3c406bb486c44c4a27e5b0497bab1cd40d.zip |
Add --time out for podman * rm -f commands
Add --time flag to podman container rm
Add --time flag to podman pod rm
Add --time flag to podman volume rm
Add --time flag to podman network rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 12 | ||||
-rw-r--r-- | pkg/api/handlers/compat/networks.go | 6 | ||||
-rw-r--r-- | pkg/api/handlers/compat/volumes.go | 5 |
3 files changed, 14 insertions, 9 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 18005e24a..4f101ce84 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -34,11 +34,12 @@ import ( func RemoveContainer(w http.ResponseWriter, r *http.Request) { decoder := r.Context().Value(api.DecoderKey).(*schema.Decoder) query := struct { - Force bool `schema:"force"` - Ignore bool `schema:"ignore"` - Link bool `schema:"link"` - DockerVolumes bool `schema:"v"` - LibpodVolumes bool `schema:"volumes"` + Force bool `schema:"force"` + Ignore bool `schema:"ignore"` + Link bool `schema:"link"` + Timeout *uint `schema:"timeout"` + DockerVolumes bool `schema:"v"` + LibpodVolumes bool `schema:"volumes"` }{ // override any golang type defaults } @@ -55,6 +56,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) { } if utils.IsLibpodRequest(r) { options.Volumes = query.LibpodVolumes + options.Timeout = query.Timeout } else { if query.Link { utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index b1456ed9e..dd28f6deb 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -245,7 +245,8 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) { ic := abi.ContainerEngine{Libpod: runtime} query := struct { - Force bool `schema:"force"` + Force bool `schema:"force"` + Timeout *uint `schema:"timeout"` }{ // This is where you can override the golang default value for one of fields } @@ -257,7 +258,8 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) { } options := entities.NetworkRmOptions{ - Force: query.Force, + Force: query.Force, + Timeout: query.Timeout, } name := utils.GetName(r) diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go index 0f9b66888..e779aa185 100644 --- a/pkg/api/handlers/compat/volumes.go +++ b/pkg/api/handlers/compat/volumes.go @@ -213,7 +213,8 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) { decoder = r.Context().Value(api.DecoderKey).(*schema.Decoder) ) query := struct { - Force bool `schema:"force"` + Force bool `schema:"force"` + Timeout *uint `schema:"timeout"` }{ // override any golang type defaults } @@ -239,7 +240,7 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) { vol, err := runtime.LookupVolume(name) if err == nil { // As above, we do not pass `force` from the query parameters here - if err := runtime.RemoveVolume(r.Context(), vol, false); err != nil { + if err := runtime.RemoveVolume(r.Context(), vol, false, query.Timeout); err != nil { if errors.Cause(err) == define.ErrVolumeBeingUsed { utils.Error(w, "volumes being used", http.StatusConflict, err) } else { |