Move "unpause" to daemon/pause.go

This is part of an effort to break apart the deprecated server/ package

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
Solomon Hykes 2014-07-30 09:35:39 +00:00
Родитель 42a77de3d3
Коммит 63bd4ad9d6
4 изменённых файлов: 19 добавлений и 17 удалений

Просмотреть файл

@ -114,6 +114,9 @@ func (daemon *Daemon) Install(eng *engine.Engine) error {
if err := eng.Register("pause", daemon.ContainerPause); err != nil {
return err
}
if err := eng.Register("unpause", daemon.ContainerUnpause); err != nil {
return err
}
return nil
}

Просмотреть файл

@ -19,3 +19,19 @@ func (daemon *Daemon) ContainerPause(job *engine.Job) engine.Status {
job.Eng.Job("log", "pause", container.ID, daemon.Repositories().ImageName(container.Image)).Run()
return engine.StatusOK
}
func (daemon *Daemon) ContainerUnpause(job *engine.Job) engine.Status {
if n := len(job.Args); n < 1 || n > 2 {
return job.Errorf("Usage: %s CONTAINER", job.Name)
}
name := job.Args[0]
container := daemon.Get(name)
if container == nil {
return job.Errorf("No such container: %s", name)
}
if err := container.Unpause(); err != nil {
return job.Errorf("Cannot unpause container %s: %s", name, err)
}
job.Eng.Job("log", "unpause", container.ID, daemon.Repositories().ImageName(container.Image)).Run()
return engine.StatusOK
}

Просмотреть файл

@ -31,22 +31,6 @@ import (
"github.com/docker/docker/utils"
)
func (srv *Server) ContainerUnpause(job *engine.Job) engine.Status {
if n := len(job.Args); n < 1 || n > 2 {
return job.Errorf("Usage: %s CONTAINER", job.Name)
}
name := job.Args[0]
container := srv.daemon.Get(name)
if container == nil {
return job.Errorf("No such container: %s", name)
}
if err := container.Unpause(); err != nil {
return job.Errorf("Cannot unpause container %s: %s", name, err)
}
srv.LogEvent("unpause", container.ID, srv.daemon.Repositories().ImageName(container.Image))
return engine.StatusOK
}
// ContainerKill send signal to the container
// If no signal is given (sig 0), then Kill with SIGKILL and wait
// for the container to exit.

Просмотреть файл

@ -92,7 +92,6 @@ func InitServer(job *engine.Job) engine.Status {
"restart": srv.ContainerRestart,
"start": srv.ContainerStart,
"kill": srv.ContainerKill,
"unpause": srv.ContainerUnpause,
"wait": srv.ContainerWait,
"tag": srv.ImageTag, // FIXME merge with "image_tag"
"resize": srv.ContainerResize,