summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/pods.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-31 08:06:41 -0800
committerGitHub <noreply@github.com>2020-01-31 08:06:41 -0800
commit1cf4b72a6ea8f6fe8344e91badd19a8fe264193e (patch)
tree835d3de0f328facc0d7c456ec3824f24fcf58e81 /pkg/api/handlers/libpod/pods.go
parentc29273e84f98e67589d8adcb7ab8d142d4563cd3 (diff)
parentf1eaccedfa08455d699d00dcda63b95aeb34833e (diff)
downloadpodman-1cf4b72a6ea8f6fe8344e91badd19a8fe264193e.tar.gz
podman-1cf4b72a6ea8f6fe8344e91badd19a8fe264193e.tar.bz2
podman-1cf4b72a6ea8f6fe8344e91badd19a8fe264193e.zip
Merge pull request #5030 from baude/apiv2longname
fix longname handling for bindings
Diffstat (limited to 'pkg/api/handlers/libpod/pods.go')
-rw-r--r--pkg/api/handlers/libpod/pods.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go
index 50d763338..091368985 100644
--- a/pkg/api/handlers/libpod/pods.go
+++ b/pkg/api/handlers/libpod/pods.go
@@ -19,8 +19,6 @@ import (
)
func PodCreate(w http.ResponseWriter, r *http.Request) {
- // 200 ok
- // 500 internal
var (
runtime = r.Context().Value("runtime").(*libpod.Runtime)
options []libpod.PodCreateOption
@@ -141,7 +139,7 @@ func Pods(w http.ResponseWriter, r *http.Request) {
func PodInspect(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -156,10 +154,6 @@ func PodInspect(w http.ResponseWriter, r *http.Request) {
}
func PodStop(w http.ResponseWriter, r *http.Request) {
- // 200
- // 304 not modified
- // 404 no such
- // 500 internal
var (
stopError error
runtime = r.Context().Value("runtime").(*libpod.Runtime)
@@ -177,7 +171,7 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
return
}
allContainersStopped := true
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -224,7 +218,7 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
func PodStart(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
allContainersRunning := true
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -278,7 +272,7 @@ func PodDelete(w http.ResponseWriter, r *http.Request) {
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
return
}
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -293,7 +287,7 @@ func PodDelete(w http.ResponseWriter, r *http.Request) {
func PodRestart(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -321,7 +315,7 @@ func PodPrune(w http.ResponseWriter, r *http.Request) {
func PodPause(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -336,11 +330,8 @@ func PodPause(w http.ResponseWriter, r *http.Request) {
}
func PodUnpause(w http.ResponseWriter, r *http.Request) {
- // 200 ok
- // 404 no such
- // 500 internal
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -379,7 +370,7 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
if err != nil {
utils.InternalServerError(w, errors.Wrapf(err, "unable to parse signal value"))
}
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
pod, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)
@@ -412,7 +403,7 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
func PodExists(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- name := mux.Vars(r)["name"]
+ name := utils.GetName(r)
_, err := runtime.LookupPod(name)
if err != nil {
utils.PodNotFound(w, name, err)