mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
42a77de3d3
commit
63bd4ad9d6
4 changed files with 19 additions and 17 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue