mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #3647 from vieux/refactor_registers
refactor registers
This commit is contained in:
commit
a823d7967f
1 changed files with 29 additions and 91 deletions
120
server.go
120
server.go
|
@ -71,97 +71,35 @@ func jobInitApi(job *engine.Job) engine.Status {
|
||||||
if srv.runtime.networkManager.bridgeNetwork != nil {
|
if srv.runtime.networkManager.bridgeNetwork != nil {
|
||||||
job.Eng.Hack_SetGlobalVar("httpapi.bridgeIP", srv.runtime.networkManager.bridgeNetwork.IP)
|
job.Eng.Hack_SetGlobalVar("httpapi.bridgeIP", srv.runtime.networkManager.bridgeNetwork.IP)
|
||||||
}
|
}
|
||||||
if err := job.Eng.Register("export", srv.ContainerExport); err != nil {
|
for name, handler := range map[string]engine.Handler{
|
||||||
job.Error(err)
|
"export": srv.ContainerExport,
|
||||||
return engine.StatusErr
|
"create": srv.ContainerCreate,
|
||||||
}
|
"stop": srv.ContainerStop,
|
||||||
if err := job.Eng.Register("create", srv.ContainerCreate); err != nil {
|
"restart": srv.ContainerRestart,
|
||||||
job.Error(err)
|
"start": srv.ContainerStart,
|
||||||
return engine.StatusErr
|
"kill": srv.ContainerKill,
|
||||||
}
|
"serveapi": srv.ListenAndServe,
|
||||||
if err := job.Eng.Register("stop", srv.ContainerStop); err != nil {
|
"wait": srv.ContainerWait,
|
||||||
job.Error(err)
|
"tag": srv.ImageTag,
|
||||||
return engine.StatusErr
|
"resize": srv.ContainerResize,
|
||||||
}
|
"commit": srv.ContainerCommit,
|
||||||
if err := job.Eng.Register("restart", srv.ContainerRestart); err != nil {
|
"info": srv.DockerInfo,
|
||||||
job.Error(err)
|
"container_delete": srv.ContainerDestroy,
|
||||||
return engine.StatusErr
|
"image_export": srv.ImageExport,
|
||||||
}
|
"images": srv.Images,
|
||||||
if err := job.Eng.Register("start", srv.ContainerStart); err != nil {
|
"history": srv.ImageHistory,
|
||||||
job.Error(err)
|
"viz": srv.ImagesViz,
|
||||||
return engine.StatusErr
|
"container_copy": srv.ContainerCopy,
|
||||||
}
|
"insert": srv.ImageInsert,
|
||||||
if err := job.Eng.Register("kill", srv.ContainerKill); err != nil {
|
"attach": srv.ContainerAttach,
|
||||||
job.Error(err)
|
"search": srv.ImagesSearch,
|
||||||
return engine.StatusErr
|
"changes": srv.ContainerChanges,
|
||||||
}
|
"top": srv.ContainerTop,
|
||||||
if err := job.Eng.Register("serveapi", srv.ListenAndServe); err != nil {
|
} {
|
||||||
job.Error(err)
|
if err := job.Eng.Register(name, handler); err != nil {
|
||||||
return engine.StatusErr
|
job.Error(err)
|
||||||
}
|
return engine.StatusErr
|
||||||
if err := job.Eng.Register("wait", srv.ContainerWait); err != nil {
|
}
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("tag", srv.ImageTag); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("resize", srv.ContainerResize); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("commit", srv.ContainerCommit); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("info", srv.DockerInfo); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("container_delete", srv.ContainerDestroy); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("image_export", srv.ImageExport); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("images", srv.Images); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("history", srv.ImageHistory); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("viz", srv.ImagesViz); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("container_copy", srv.ContainerCopy); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("insert", srv.ImageInsert); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("attach", srv.ContainerAttach); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("search", srv.ImagesSearch); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("changes", srv.ContainerChanges); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
|
||||||
if err := job.Eng.Register("top", srv.ContainerTop); err != nil {
|
|
||||||
job.Error(err)
|
|
||||||
return engine.StatusErr
|
|
||||||
}
|
}
|
||||||
return engine.StatusOK
|
return engine.StatusOK
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue