Remove job from resize&execResize
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
parent
eebfcde0ea
commit
e290a22dc9
3 changed files with 32 additions and 47 deletions
|
@ -1005,9 +1005,26 @@ func postContainersResize(eng *engine.Engine, version version.Version, w http.Re
|
|||
if vars == nil {
|
||||
return fmt.Errorf("Missing parameter")
|
||||
}
|
||||
if err := eng.Job("resize", vars["name"], r.Form.Get("h"), r.Form.Get("w")).Run(); err != nil {
|
||||
|
||||
height, err := strconv.Atoi(r.Form.Get("h"))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
width, err := strconv.Atoi(r.Form.Get("w"))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
d := getDaemon(eng)
|
||||
cont, err := d.Get(vars["name"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := cont.Resize(height, width); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1363,9 +1380,21 @@ func postContainerExecResize(eng *engine.Engine, version version.Version, w http
|
|||
if vars == nil {
|
||||
return fmt.Errorf("Missing parameter")
|
||||
}
|
||||
if err := eng.Job("execResize", vars["name"], r.Form.Get("h"), r.Form.Get("w")).Run(); err != nil {
|
||||
|
||||
height, err := strconv.Atoi(r.Form.Get("h"))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
width, err := strconv.Atoi(r.Form.Get("w"))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
d := getDaemon(eng)
|
||||
if err := d.ContainerExecResize(vars["name"], height, width); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ func (daemon *Daemon) Install(eng *engine.Engine) error {
|
|||
"info": daemon.CmdInfo,
|
||||
"kill": daemon.ContainerKill,
|
||||
"logs": daemon.ContainerLogs,
|
||||
"resize": daemon.ContainerResize,
|
||||
"restart": daemon.ContainerRestart,
|
||||
"start": daemon.ContainerStart,
|
||||
"stop": daemon.ContainerStop,
|
||||
|
@ -133,7 +132,6 @@ func (daemon *Daemon) Install(eng *engine.Engine) error {
|
|||
"wait": daemon.ContainerWait,
|
||||
"execCreate": daemon.ContainerExecCreate,
|
||||
"execStart": daemon.ContainerExecStart,
|
||||
"execResize": daemon.ContainerExecResize,
|
||||
"execInspect": daemon.ContainerExecInspect,
|
||||
} {
|
||||
if err := eng.Register(name, method); err != nil {
|
||||
|
|
|
@ -1,48 +1,6 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/docker/docker/engine"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) ContainerResize(job *engine.Job) error {
|
||||
if len(job.Args) != 3 {
|
||||
return fmt.Errorf("Not enough arguments. Usage: %s CONTAINER HEIGHT WIDTH\n", job.Name)
|
||||
}
|
||||
name := job.Args[0]
|
||||
height, err := strconv.Atoi(job.Args[1])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
width, err := strconv.Atoi(job.Args[2])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
container, err := daemon.Get(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := container.Resize(height, width); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (daemon *Daemon) ContainerExecResize(job *engine.Job) error {
|
||||
if len(job.Args) != 3 {
|
||||
return fmt.Errorf("Not enough arguments. Usage: %s EXEC HEIGHT WIDTH\n", job.Name)
|
||||
}
|
||||
name := job.Args[0]
|
||||
height, err := strconv.Atoi(job.Args[1])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
width, err := strconv.Atoi(job.Args[2])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func (daemon *Daemon) ContainerExecResize(name string, height, width int) error {
|
||||
execConfig, err := daemon.getExecConfig(name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue