mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove job from export
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
a54fd325e6
commit
6b737752e3
3 changed files with 6 additions and 16 deletions
|
@ -280,12 +280,10 @@ func getContainersExport(eng *engine.Engine, version version.Version, w http.Res
|
|||
if vars == nil {
|
||||
return fmt.Errorf("Missing parameter")
|
||||
}
|
||||
job := eng.Job("export", vars["name"])
|
||||
job.Stdout.Add(w)
|
||||
if err := job.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
d := getDaemon(eng)
|
||||
|
||||
return d.ContainerExport(vars["name"], w)
|
||||
}
|
||||
|
||||
func getImagesJSON(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
|
|
|
@ -121,7 +121,6 @@ func (daemon *Daemon) Install(eng *engine.Engine) error {
|
|||
"container_inspect": daemon.ContainerInspect,
|
||||
"container_stats": daemon.ContainerStats,
|
||||
"create": daemon.ContainerCreate,
|
||||
"export": daemon.ContainerExport,
|
||||
"info": daemon.CmdInfo,
|
||||
"logs": daemon.ContainerLogs,
|
||||
"restart": daemon.ContainerRestart,
|
||||
|
|
|
@ -3,16 +3,9 @@ package daemon
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/engine"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) ContainerExport(job *engine.Job) error {
|
||||
if len(job.Args) != 1 {
|
||||
return fmt.Errorf("Usage: %s container_id", job.Name)
|
||||
}
|
||||
name := job.Args[0]
|
||||
|
||||
func (daemon *Daemon) ContainerExport(name string, out io.Writer) error {
|
||||
container, err := daemon.Get(name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -25,7 +18,7 @@ func (daemon *Daemon) ContainerExport(job *engine.Job) error {
|
|||
defer data.Close()
|
||||
|
||||
// Stream the entire contents of the container (basically a volatile snapshot)
|
||||
if _, err := io.Copy(job.Stdout, data); err != nil {
|
||||
if _, err := io.Copy(out, data); err != nil {
|
||||
return fmt.Errorf("%s: %s", name, err)
|
||||
}
|
||||
// FIXME: factor job-specific LogEvent to engine.Job.Run()
|
||||
|
|
Loading…
Reference in a new issue