Make the autopull compatible with new registry

This commit is contained in:
Guillaume J. Charmes 2013-05-06 16:40:45 -07:00
Родитель 2bc4ad9402
Коммит 62a1850c16
1 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -200,21 +200,23 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e
image, err = builder.runtime.repositories.LookupImage(arguments)
if err != nil {
if builder.runtime.graph.IsNotExist(err) {
if builder.runtime.graph.LookupRemoteImage(arguments, builder.runtime.authConfig) {
if err := builder.runtime.graph.PullImage(stdout, arguments, builder.runtime.authConfig); err != nil {
return nil, err
}
} else {
// FIXME: Allow pull repo:tag
if err := builder.runtime.graph.PullRepository(stdout, arguments, "", builder.runtime.repositories, builder.runtime.authConfig); err != nil {
return nil, err
}
var tag, remote string
if strings.Contains(remote, ":") {
remoteParts := strings.Split(remote, ":")
tag = remoteParts[1]
remote = remoteParts[0]
}
if err := builder.runtime.graph.PullRepository(stdout, remote, tag, builder.runtime.repositories, builder.runtime.authConfig); err != nil {
return nil, err
}
image, err = builder.runtime.repositories.LookupImage(arguments)
if err != nil {
return nil, err
}
} else {
return nil, err
}