summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/images.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-01-24 08:59:20 -0600
committerBrent Baude <bbaude@redhat.com>2020-01-25 15:09:09 -0600
commit5da70b04dd95263a536cc148288d2e20cd9dea30 (patch)
tree3d28c000a7941d9f8ea4aef906d29a44c2e80484 /pkg/api/handlers/images.go
parent81e59a742b46d41848c8c213e155fbc9ecc4e5f8 (diff)
downloadpodman-5da70b04dd95263a536cc148288d2e20cd9dea30.tar.gz
podman-5da70b04dd95263a536cc148288d2e20cd9dea30.tar.bz2
podman-5da70b04dd95263a536cc148288d2e20cd9dea30.zip
APIv2 review corrections #3
The third pass of corrections for the APIv2. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api/handlers/images.go')
-rw-r--r--pkg/api/handlers/images.go41
1 files changed, 0 insertions, 41 deletions
diff --git a/pkg/api/handlers/images.go b/pkg/api/handlers/images.go
index b4acdc312..3f66a63c8 100644
--- a/pkg/api/handlers/images.go
+++ b/pkg/api/handlers/images.go
@@ -3,7 +3,6 @@ package handlers
import (
"fmt"
"io"
- "io/ioutil"
"net/http"
"os"
"strconv"
@@ -127,46 +126,6 @@ func GetImage(r *http.Request, name string) (*image.Image, error) {
return runtime.ImageRuntime().NewFromLocal(name)
}
-func LoadImage(w http.ResponseWriter, r *http.Request) {
- decoder := r.Context().Value("decoder").(*schema.Decoder)
- runtime := r.Context().Value("runtime").(*libpod.Runtime)
-
- query := struct {
- //quiet bool # quiet is currently unused
- }{
- // This is where you can override the golang default value for one of fields
- }
-
- if err := decoder.Decode(&query, r.URL.Query()); err != nil {
- utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
- return
- }
-
- var (
- err error
- writer io.Writer
- )
- f, err := ioutil.TempFile("", "api_load.tar")
- if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "failed to create tempfile"))
- return
- }
- if err := SaveFromBody(f, r); err != nil {
- utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "failed to write temporary file"))
- return
- }
- id, err := runtime.LoadImage(r.Context(), "", f.Name(), writer, "")
- if err != nil {
- utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "failed to load image"))
- return
- }
- utils.WriteResponse(w, http.StatusOK, struct {
- Stream string `json:"stream"`
- }{
- Stream: fmt.Sprintf("Loaded image: %s\n", id),
- })
-}
-
func SaveFromBody(f *os.File, r *http.Request) error { // nolint
if _, err := io.Copy(f, r.Body); err != nil {
return err