mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
bump to master
This commit is contained in:
@@ -63,9 +63,6 @@ func (srv *Server) ImagesSearch(term string) ([]APISearch, error) {
|
||||
for _, repo := range results.Results {
|
||||
var out APISearch
|
||||
out.Description = repo["description"]
|
||||
if len(out.Description) > 45 {
|
||||
out.Description = utils.Trunc(out.Description, 42) + "..."
|
||||
}
|
||||
out.Name = repo["name"]
|
||||
outs = append(outs, out)
|
||||
}
|
||||
@@ -330,8 +327,8 @@ func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgId, endpoin
|
||||
return nil
|
||||
}
|
||||
|
||||
func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, remote, askedTag string, sf *utils.StreamFormatter) error {
|
||||
out.Write(sf.FormatStatus("Pulling repository %s from %s", remote, auth.IndexServerAddress()))
|
||||
func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, local, remote, askedTag string, sf *utils.StreamFormatter) error {
|
||||
out.Write(sf.FormatStatus("Pulling repository %s from %s", local, auth.IndexServerAddress()))
|
||||
repoData, err := r.GetRepositoryData(remote)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -358,7 +355,7 @@ func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, remote, a
|
||||
// Otherwise, check that the tag exists and use only that one
|
||||
id, exists := tagsList[askedTag]
|
||||
if !exists {
|
||||
return fmt.Errorf("Tag %s not found in repositoy %s", askedTag, remote)
|
||||
return fmt.Errorf("Tag %s not found in repositoy %s", askedTag, local)
|
||||
}
|
||||
repoData.ImgList[id].Tag = askedTag
|
||||
}
|
||||
@@ -386,7 +383,7 @@ func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, remote, a
|
||||
if askedTag != "" && tag != askedTag {
|
||||
continue
|
||||
}
|
||||
if err := srv.runtime.repositories.Set(remote, tag, id, true); err != nil {
|
||||
if err := srv.runtime.repositories.Set(local, tag, id, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -406,8 +403,12 @@ func (srv *Server) ImagePull(name, tag, endpoint string, out io.Writer, sf *util
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := srv.pullRepository(r, out, name, tag, sf); err != nil {
|
||||
remote := name
|
||||
parts := strings.Split(name, "/")
|
||||
if len(parts) > 2 {
|
||||
remote = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
|
||||
}
|
||||
if err := srv.pullRepository(r, out, name, remote, tag, sf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -489,7 +490,13 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
|
||||
}
|
||||
out.Write(sf.FormatStatus("Sending image list"))
|
||||
|
||||
repoData, err := r.PushImageJSONIndex(name, imgList, false)
|
||||
srvName := name
|
||||
parts := strings.Split(name, "/")
|
||||
if len(parts) > 2 {
|
||||
srvName = fmt.Sprintf("src/%s", url.QueryEscape(strings.Join(parts, "/")))
|
||||
}
|
||||
|
||||
repoData, err := r.PushImageJSONIndex(srvName, imgList, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -506,14 +513,14 @@ func (srv *Server) pushRepository(r *registry.Registry, out io.Writer, name stri
|
||||
// FIXME: Continue on error?
|
||||
return err
|
||||
}
|
||||
out.Write(sf.FormatStatus("Pushing tags for rev [%s] on {%s}", elem.ID, ep+"/users/"+name+"/"+elem.Tag))
|
||||
if err := r.PushRegistryTag(name, elem.ID, elem.Tag, ep, repoData.Tokens); err != nil {
|
||||
out.Write(sf.FormatStatus("Pushing tags for rev [%s] on {%s}", elem.ID, ep+"/users/"+srvName+"/"+elem.Tag))
|
||||
if err := r.PushRegistryTag(srvName, elem.ID, elem.Tag, ep, repoData.Tokens); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := r.PushImageJSONIndex(name, imgList, true); err != nil {
|
||||
if _, err := r.PushImageJSONIndex(srvName, imgList, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -869,7 +876,7 @@ func (srv *Server) ImageInspect(name string) (*Image, error) {
|
||||
return nil, fmt.Errorf("No such image: %s", name)
|
||||
}
|
||||
|
||||
func NewServer(autoRestart bool) (*Server, error) {
|
||||
func NewServer(autoRestart, enableCors bool) (*Server, error) {
|
||||
if runtime.GOARCH != "amd64" {
|
||||
log.Fatalf("The docker runtime currently only supports amd64 (not %s). This will change in the future. Aborting.", runtime.GOARCH)
|
||||
}
|
||||
@@ -878,12 +885,14 @@ func NewServer(autoRestart bool) (*Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
srv := &Server{
|
||||
runtime: runtime,
|
||||
runtime: runtime,
|
||||
enableCors: enableCors,
|
||||
}
|
||||
runtime.srv = srv
|
||||
return srv, nil
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
runtime *Runtime
|
||||
runtime *Runtime
|
||||
enableCors bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user