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 {
|
if vars == nil {
|
||||||
return fmt.Errorf("Missing parameter")
|
return fmt.Errorf("Missing parameter")
|
||||||
}
|
}
|
||||||
job := eng.Job("export", vars["name"])
|
|
||||||
job.Stdout.Add(w)
|
d := getDaemon(eng)
|
||||||
if err := job.Run(); err != nil {
|
|
||||||
return err
|
return d.ContainerExport(vars["name"], w)
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getImagesJSON(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
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_inspect": daemon.ContainerInspect,
|
||||||
"container_stats": daemon.ContainerStats,
|
"container_stats": daemon.ContainerStats,
|
||||||
"create": daemon.ContainerCreate,
|
"create": daemon.ContainerCreate,
|
||||||
"export": daemon.ContainerExport,
|
|
||||||
"info": daemon.CmdInfo,
|
"info": daemon.CmdInfo,
|
||||||
"logs": daemon.ContainerLogs,
|
"logs": daemon.ContainerLogs,
|
||||||
"restart": daemon.ContainerRestart,
|
"restart": daemon.ContainerRestart,
|
||||||
|
|
|
@ -3,16 +3,9 @@ package daemon
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/engine"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (daemon *Daemon) ContainerExport(job *engine.Job) error {
|
func (daemon *Daemon) ContainerExport(name string, out io.Writer) error {
|
||||||
if len(job.Args) != 1 {
|
|
||||||
return fmt.Errorf("Usage: %s container_id", job.Name)
|
|
||||||
}
|
|
||||||
name := job.Args[0]
|
|
||||||
|
|
||||||
container, err := daemon.Get(name)
|
container, err := daemon.Get(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -25,7 +18,7 @@ func (daemon *Daemon) ContainerExport(job *engine.Job) error {
|
||||||
defer data.Close()
|
defer data.Close()
|
||||||
|
|
||||||
// Stream the entire contents of the container (basically a volatile snapshot)
|
// 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)
|
return fmt.Errorf("%s: %s", name, err)
|
||||||
}
|
}
|
||||||
// FIXME: factor job-specific LogEvent to engine.Job.Run()
|
// FIXME: factor job-specific LogEvent to engine.Job.Run()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue