image mgmt: deal with docker images only for now

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-09-18 18:24:12 +02:00
parent e9cb1b1868
commit 3ad20d1e51
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 6 additions and 7 deletions

View file

@ -325,7 +325,7 @@ func PullImage(client pb.ImageServiceClient, image string) error {
return nil return nil
} }
// try this with ./ocic pullimage docker://busybox // try this with ./ocic pullimage busybox
var pullImageCommand = cli.Command{ var pullImageCommand = cli.Command{
Name: "pull", Name: "pull",
Usage: "pull an image", Usage: "pull an image",

View file

@ -2,9 +2,9 @@ package server
import ( import (
"errors" "errors"
"fmt"
ic "github.com/containers/image/copy" ic "github.com/containers/image/copy"
"github.com/containers/image/docker"
"github.com/containers/image/signature" "github.com/containers/image/signature"
"github.com/containers/image/storage" "github.com/containers/image/storage"
"github.com/containers/image/transports" "github.com/containers/image/transports"
@ -52,15 +52,14 @@ func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.P
} }
// TODO(runcom): deal with AuthConfig in req.GetAuth() // TODO(runcom): deal with AuthConfig in req.GetAuth()
sr, err := transports.ParseImageName(img) // FIXME: pretend that the image coming from k8s is in docker format
// because k8s haven't yet figured out a way for multiple image
// formats - https://github.com/kubernetes/features/issues/63
sr, err := transports.ParseImageName(docker.Transport.Name() + "://" + img)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if sr.Transport().Name() != "docker" {
return nil, fmt.Errorf("can only pull docker images, got %s", sr.Transport().Name())
}
dr, err := transports.ParseImageName(storage.Transport.Name() + ":" + sr.DockerReference().String()) dr, err := transports.ParseImageName(storage.Transport.Name() + ":" + sr.DockerReference().String())
if err != nil { if err != nil {
return nil, err return nil, err