From 6b737752e342e30dd20417b18c92c9b4e1c4f8da Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Sun, 12 Apr 2015 16:04:01 +0200 Subject: [PATCH] Remove job from export Signed-off-by: Antonio Murdaca --- api/server/server.go | 10 ++++------ daemon/daemon.go | 1 - daemon/export.go | 11 ++--------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/api/server/server.go b/api/server/server.go index d1f9b18946..6d9df561cb 100644 --- a/api/server/server.go +++ b/api/server/server.go @@ -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 { diff --git a/daemon/daemon.go b/daemon/daemon.go index 40d1ecb418..748dd5cf5c 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -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, diff --git a/daemon/export.go b/daemon/export.go index b1417b932c..b94b6100cb 100644 --- a/daemon/export.go +++ b/daemon/export.go @@ -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()