From 65185a565b8e05a2dd58e10d1c1ad560f4a255cf Mon Sep 17 00:00:00 2001 From: Nan Monnand Deng Date: Fri, 28 Jun 2013 17:33:28 -0400 Subject: [PATCH] added APIVersion when call NewRegistry --- api_params.go | 12 ++++++++++++ server.go | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/api_params.go b/api_params.go index b8af690c7f..217062b66f 100644 --- a/api_params.go +++ b/api_params.go @@ -66,6 +66,18 @@ type APIVersion struct { GoVersion string `json:",omitempty"` } +func (v *APIVersion) Name() string { + return "docker" +} + +func (v *APIVersion) Version() string { + r, err := json.Marshal(v) + if err != nil { + return r.Version + } + return string(r) +} + type APIWait struct { StatusCode int } diff --git a/server.go b/server.go index f1c0909516..c1ea5670e0 100644 --- a/server.go +++ b/server.go @@ -55,7 +55,7 @@ func (srv *Server) ContainerExport(name string, out io.Writer) error { } func (srv *Server) ImagesSearch(term string) ([]APISearch, error) { - r, err := registry.NewRegistry(srv.runtime.root, nil) + r, err := registry.NewRegistry(srv.runtime.root, nil, srv.DockerVersion()) if err != nil { return nil, err } @@ -470,7 +470,7 @@ func (srv *Server) poolRemove(kind, key string) error { } func (srv *Server) ImagePull(localName string, tag string, out io.Writer, sf *utils.StreamFormatter, authConfig *auth.AuthConfig) error { - r, err := registry.NewRegistry(srv.runtime.root, authConfig) + r, err := registry.NewRegistry(srv.runtime.root, authConfig, srv.DockerVersion()) if err != nil { return err } @@ -687,7 +687,7 @@ func (srv *Server) ImagePush(localName string, out io.Writer, sf *utils.StreamFo out = utils.NewWriteFlusher(out) img, err := srv.runtime.graph.Get(localName) - r, err2 := registry.NewRegistry(srv.runtime.root, authConfig) + r, err2 := registry.NewRegistry(srv.runtime.root, authConfig, srv.DockerVersion()) if err2 != nil { return err2 }