storage: Support latest containers/image

Signed-off-by: Andrew Pilloud <andrewpilloud@igneoussystems.com>
This commit is contained in:
Andrew Pilloud 2017-03-13 08:16:03 -07:00
parent ee3027f8be
commit 54c176e336
3 changed files with 12 additions and 12 deletions

View file

@ -4,7 +4,7 @@ import (
"github.com/containers/image/copy"
"github.com/containers/image/signature"
istorage "github.com/containers/image/storage"
"github.com/containers/image/transports"
"github.com/containers/image/transports/alltransports"
"github.com/containers/image/types"
"github.com/containers/storage/storage"
)
@ -64,7 +64,7 @@ func (svc *imageService) ListImages(filter string) ([]ImageResult, error) {
}
func (svc *imageService) ImageStatus(systemContext *types.SystemContext, nameOrID string) (*ImageResult, error) {
ref, err := transports.ParseImageName(nameOrID)
ref, err := alltransports.ParseImageName(nameOrID)
if err != nil {
ref2, err2 := istorage.Transport.ParseStoreReference(svc.store, "@"+nameOrID)
if err2 != nil {
@ -118,12 +118,12 @@ func (svc *imageService) PullImage(systemContext *types.SystemContext, imageName
if options == nil {
options = &copy.Options{}
}
srcRef, err := transports.ParseImageName(imageName)
srcRef, err := alltransports.ParseImageName(imageName)
if err != nil {
if svc.defaultTransport == "" {
return nil, err
}
srcRef2, err2 := transports.ParseImageName(svc.defaultTransport + imageName)
srcRef2, err2 := alltransports.ParseImageName(svc.defaultTransport + imageName)
if err2 != nil {
return nil, err
}
@ -131,7 +131,7 @@ func (svc *imageService) PullImage(systemContext *types.SystemContext, imageName
}
dest := imageName
if srcRef.DockerReference() != nil {
dest = srcRef.DockerReference().FullName()
dest = srcRef.DockerReference().Name()
}
destRef, err := istorage.Transport.ParseStoreReference(svc.store, dest)
if err != nil {
@ -157,7 +157,7 @@ func (svc *imageService) PullImage(systemContext *types.SystemContext, imageName
}
func (svc *imageService) RemoveImage(systemContext *types.SystemContext, nameOrID string) error {
ref, err := transports.ParseImageName(nameOrID)
ref, err := alltransports.ParseImageName(nameOrID)
if err != nil {
ref2, err2 := istorage.Transport.ParseStoreReference(svc.store, "@"+nameOrID)
if err2 != nil {

View file

@ -9,7 +9,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/containers/image/copy"
istorage "github.com/containers/image/storage"
"github.com/containers/image/transports"
"github.com/containers/image/transports/alltransports"
"github.com/containers/image/types"
"github.com/containers/storage/storage"
"github.com/opencontainers/image-spec/specs-go/v1"
@ -162,9 +162,9 @@ func (r *runtimeService) createContainerOrPodSandbox(systemContext *types.System
ref, err := istorage.Transport.ParseStoreReference(r.image.GetStore(), imageName)
if err != nil {
// Maybe it's some other transport's copy of the image?
otherRef, err2 := transports.ParseImageName(imageName)
otherRef, err2 := alltransports.ParseImageName(imageName)
if err2 == nil && otherRef.DockerReference() != nil {
ref, err = istorage.Transport.ParseStoreReference(r.image.GetStore(), otherRef.DockerReference().FullName())
ref, err = istorage.Transport.ParseStoreReference(r.image.GetStore(), otherRef.DockerReference().Name())
}
if err != nil {
// Maybe the image ID is sufficient?

View file

@ -7,7 +7,7 @@ import (
"github.com/containers/image/copy"
"github.com/containers/image/signature"
"github.com/containers/image/storage"
"github.com/containers/image/transports"
"github.com/containers/image/transports/alltransports"
"github.com/containers/image/types"
"github.com/containers/storage/pkg/reexec"
sstorage "github.com/containers/storage/storage"
@ -137,7 +137,7 @@ func main() {
options := &copy.Options{}
if importFrom != "" {
importRef, err = transports.ParseImageName(importFrom)
importRef, err = alltransports.ParseImageName(importFrom)
if err != nil {
logrus.Errorf("error parsing image name %v: %v", importFrom, err)
os.Exit(1)
@ -145,7 +145,7 @@ func main() {
}
if exportTo != "" {
exportRef, err = transports.ParseImageName(exportTo)
exportRef, err = alltransports.ParseImageName(exportTo)
if err != nil {
logrus.Errorf("error parsing image name %v: %v", exportTo, err)
os.Exit(1)