func (h *jobAPI) PullImages(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { log := h.host.log.New("fn", "PullImages") log.Info("extracting TUF database") tufDB, err := extractTufDB(r) if err != nil { log.Error("error extracting TUF database", "err", err) httphelper.Error(w, err) return } defer os.Remove(tufDB) info := make(chan layer.PullInfo) stream := sse.NewStream(w, info, nil) go stream.Serve() log.Info("pulling images") if err := pinkerton.PullImages( tufDB, r.URL.Query().Get("repository"), r.URL.Query().Get("driver"), r.URL.Query().Get("root"), r.URL.Query().Get("version"), info, ); err != nil { log.Error("error pulling images", "err", err) stream.CloseWithError(err) return } stream.Wait() }
func (h *jobAPI) PullImages(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { tufDB, err := extractTufDB(r) if err != nil { httphelper.Error(w, err) return } defer os.Remove(tufDB) info := make(chan layer.PullInfo) stream := sse.NewStream(w, info, nil) go stream.Serve() if err := pinkerton.PullImages( tufDB, r.URL.Query().Get("repository"), r.URL.Query().Get("driver"), r.URL.Query().Get("root"), info, ); err != nil { stream.CloseWithError(err) return } stream.Wait() }