refactor create to not expose internal data structures

- use existing exposed type

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
This commit is contained in:
Morgan Bauer
2015-09-25 09:35:18 -07:00
parent 02ae137b1d
commit 93bd57b0b2
3 changed files with 23 additions and 19 deletions
+4 -9
View File
@@ -366,10 +366,8 @@ func (s *Server) postContainersCreate(ctx context.Context, w http.ResponseWriter
if err := checkForJSON(r); err != nil {
return err
}
var (
warnings []string
name = r.Form.Get("name")
)
name := r.Form.Get("name")
config, hostConfig, err := runconfig.DecodeContainerConfig(r.Body)
if err != nil {
@@ -378,15 +376,12 @@ func (s *Server) postContainersCreate(ctx context.Context, w http.ResponseWriter
version := ctx.Version()
adjustCPUShares := version.LessThan("1.19")
container, warnings, err := s.daemon.ContainerCreate(ctx, name, config, hostConfig, adjustCPUShares)
ccr, err := s.daemon.ContainerCreate(ctx, name, config, hostConfig, adjustCPUShares)
if err != nil {
return err
}
return writeJSON(w, http.StatusCreated, &types.ContainerCreateResponse{
ID: container.ID,
Warnings: warnings,
})
return writeJSON(w, http.StatusCreated, ccr)
}
func (s *Server) deleteContainers(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {