diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/images.go | 20 | ||||
-rw-r--r-- | cmd/podman/import.go | 2 | ||||
-rw-r--r-- | cmd/podman/load.go | 15 | ||||
-rw-r--r-- | cmd/podman/pull.go | 25 | ||||
-rw-r--r-- | cmd/podman/push.go | 36 | ||||
-rw-r--r-- | cmd/podman/rmi.go | 3 | ||||
-rw-r--r-- | cmd/podman/save.go | 14 |
7 files changed, 49 insertions, 66 deletions
diff --git a/cmd/podman/images.go b/cmd/podman/images.go index 67f7920f2..4e2114705 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -82,7 +82,7 @@ var ( func imagesCmd(c *cli.Context) error { var ( - filterFuncs []libpod.ImageResultFilter + filterFuncs []image.ResultFilter newImage *image.Image ) if err := validateFlags(c, imagesFlags); err != nil { @@ -136,7 +136,7 @@ func imagesCmd(c *cli.Context) error { var filteredImages []*image.Image // filter the images if len(c.StringSlice("filter")) > 0 || newImage != nil { - filteredImages = libpod.FilterImages(images, filterFuncs) + filteredImages = image.FilterImages(images, filterFuncs) } else { filteredImages = images } @@ -266,8 +266,8 @@ func (i *imagesTemplateParams) HeaderMap() map[string]string { // CreateFilterFuncs returns an array of filter functions based on the user inputs // and is later used to filter images for output -func CreateFilterFuncs(r *libpod.Runtime, c *cli.Context, image *image.Image) ([]libpod.ImageResultFilter, error) { - var filterFuncs []libpod.ImageResultFilter +func CreateFilterFuncs(r *libpod.Runtime, c *cli.Context, img *image.Image) ([]image.ResultFilter, error) { + var filterFuncs []image.ResultFilter for _, filter := range c.StringSlice("filter") { splitFilter := strings.Split(filter, "=") switch splitFilter[0] { @@ -276,24 +276,24 @@ func CreateFilterFuncs(r *libpod.Runtime, c *cli.Context, image *image.Image) ([ if err != nil { return nil, errors.Wrapf(err, "unable to find image % in local stores", splitFilter[1]) } - filterFuncs = append(filterFuncs, libpod.ImageCreatedBefore(before.Created())) + filterFuncs = append(filterFuncs, image.CreatedBeforeFilter(before.Created())) case "after": after, err := r.ImageRuntime().NewFromLocal(splitFilter[1]) if err != nil { return nil, errors.Wrapf(err, "unable to find image % in local stores", splitFilter[1]) } - filterFuncs = append(filterFuncs, libpod.ImageCreatedAfter(after.Created())) + filterFuncs = append(filterFuncs, image.CreatedAfterFilter(after.Created())) case "dangling": - filterFuncs = append(filterFuncs, libpod.ImageDangling()) + filterFuncs = append(filterFuncs, image.DanglingFilter()) case "label": labelFilter := strings.Join(splitFilter[1:], "=") - filterFuncs = append(filterFuncs, libpod.ImageLabel(labelFilter)) + filterFuncs = append(filterFuncs, image.LabelFilter(labelFilter)) default: return nil, errors.Errorf("invalid filter %s ", splitFilter[0]) } } - if image != nil { - filterFuncs = append(filterFuncs, libpod.OutputImageFilter(image)) + if img != nil { + filterFuncs = append(filterFuncs, image.OutputImageFilter(img)) } return filterFuncs, nil } diff --git a/cmd/podman/import.go b/cmd/podman/import.go index 6f7565b4b..bebd4486c 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -107,7 +107,7 @@ func importCmd(c *cli.Context) error { source = file } - newImage, err := runtime.Import(source, reference, writer, image.SigningOptions{}, config) + newImage, err := runtime.ImageRuntime().Import(source, reference, writer, image.SigningOptions{}, config) if err == nil { fmt.Println(newImage.ID()) } diff --git a/cmd/podman/load.go b/cmd/podman/load.go index d3a15a2ae..8146f4c5d 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -8,6 +8,7 @@ import ( "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" + libpodImage "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) @@ -44,6 +45,7 @@ func loadCmd(c *cli.Context) error { args := c.Args() var image string + if len(args) == 1 { image = args[0] } @@ -96,28 +98,23 @@ func loadCmd(c *cli.Context) error { writer = os.Stderr } - options := libpod.CopyOptions{ - SignaturePolicyPath: c.String("signature-policy"), - Writer: writer, - } - src := libpod.DockerArchive + ":" + input - imgName, err := runtime.PullImage(src, options) + newImage, err := runtime.ImageRuntime().New(src, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}) if err != nil { // generate full src name with specified image:tag fullSrc := libpod.OCIArchive + ":" + input if image != "" { fullSrc = fullSrc + ":" + image } - imgName, err = runtime.PullImage(fullSrc, options) + newImage, err = runtime.ImageRuntime().New(fullSrc, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}) if err != nil { src = libpod.DirTransport + ":" + input - imgName, err = runtime.PullImage(src, options) + newImage, err = runtime.ImageRuntime().New(src, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}) if err != nil { return errors.Wrapf(err, "error pulling %q", src) } } } - fmt.Println("Loaded image: ", imgName) + fmt.Println("Loaded image: ", newImage.InputName) return nil } diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 5dc9ef2d4..28d69cfdd 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -8,8 +8,7 @@ import ( "github.com/containers/image/types" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/libpod/common" + image2 "github.com/projectatomic/libpod/libpod/image" "github.com/projectatomic/libpod/pkg/util" "github.com/sirupsen/logrus" "github.com/urfave/cli" @@ -94,27 +93,19 @@ func pullCmd(c *cli.Context) error { writer = os.Stderr } - options := libpod.CopyOptions{ - SignaturePolicyPath: c.String("signature-policy"), - AuthFile: c.String("authfile"), - DockerRegistryOptions: common.DockerRegistryOptions{ - DockerRegistryCreds: registryCreds, - DockerCertPath: c.String("cert-dir"), - DockerInsecureSkipTLSVerify: !c.BoolT("tls-verify"), - }, - Writer: writer, + dockerRegistryOptions := image2.DockerRegistryOptions{ + DockerRegistryCreds: registryCreds, + DockerCertPath: c.String("cert-dir"), + DockerInsecureSkipTLSVerify: !c.BoolT("tls-verify"), } - if _, err := runtime.PullImage(image, options); err != nil { + newImage, err := runtime.ImageRuntime().New(image, c.String("signature-policy"), c.String("authfile"), writer, &dockerRegistryOptions, image2.SigningOptions{}) + if err != nil { return errors.Wrapf(err, "error pulling image %q", image) } - newImage := runtime.NewImage(image) - iid, err := newImage.GetImageID() // Intentially choosing to ignore if there is an error because // outputting the image ID is a NTH and not integral to the pull - if err == nil { - fmt.Println(iid) - } + fmt.Println(newImage.ID()) return nil } diff --git a/cmd/podman/push.go b/cmd/podman/push.go index e16b91611..3a39a1a0e 100644 --- a/cmd/podman/push.go +++ b/cmd/podman/push.go @@ -8,11 +8,10 @@ import ( "github.com/containers/image/manifest" "github.com/containers/image/types" - "github.com/containers/storage/pkg/archive" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" - "github.com/projectatomic/libpod/libpod/common" + "github.com/projectatomic/libpod/libpod/image" "github.com/projectatomic/libpod/pkg/util" "github.com/urfave/cli" ) @@ -135,23 +134,22 @@ func pushCmd(c *cli.Context) error { } } - options := libpod.CopyOptions{ - Compression: archive.Uncompressed, - SignaturePolicyPath: c.String("signature-policy"), - DockerRegistryOptions: common.DockerRegistryOptions{ - DockerRegistryCreds: registryCreds, - DockerCertPath: certPath, - DockerInsecureSkipTLSVerify: skipVerify, - }, - SigningOptions: common.SigningOptions{ - RemoveSignatures: removeSignatures, - SignBy: signBy, - }, - AuthFile: c.String("authfile"), - Writer: writer, - ManifestMIMEType: manifestType, - ForceCompress: c.Bool("compress"), + dockerRegistryOptions := image.DockerRegistryOptions{ + DockerRegistryCreds: registryCreds, + DockerCertPath: certPath, + DockerInsecureSkipTLSVerify: skipVerify, + } + + so := image.SigningOptions{ + RemoveSignatures: removeSignatures, + SignBy: signBy, + } + + newImage, err := runtime.ImageRuntime().NewFromLocal(srcName) + if err != nil { + return err } - return runtime.PushImage(srcName, destName, options) + //return runtime.PushImage(srcName, destName, options) + return newImage.PushImage(destName, manifestType, c.String("authfile"), c.String("signature-policy"), writer, c.Bool("compress"), so, &dockerRegistryOptions) } diff --git a/cmd/podman/rmi.go b/cmd/podman/rmi.go index cc902cdbe..244e07a06 100644 --- a/cmd/podman/rmi.go +++ b/cmd/podman/rmi.go @@ -5,7 +5,6 @@ import ( "os" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) @@ -56,7 +55,7 @@ func rmiCmd(c *cli.Context) error { var lastError error var imagesToDelete []*image.Image if removeAll { - imagesToDelete, err = runtime.GetImages(&libpod.ImageFilterParams{}) + imagesToDelete, err = runtime.ImageRuntime().GetImages() if err != nil { return errors.Wrapf(err, "unable to query local images") } diff --git a/cmd/podman/save.go b/cmd/podman/save.go index 5ceb456f4..009984640 100644 --- a/cmd/podman/save.go +++ b/cmd/podman/save.go @@ -9,6 +9,7 @@ import ( imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" "github.com/projectatomic/libpod/libpod" + libpodImage "github.com/projectatomic/libpod/libpod/image" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -104,13 +105,6 @@ func saveCmd(c *cli.Context) error { return errors.Errorf("unknown format option %q", c.String("format")) } - saveOpts := libpod.CopyOptions{ - SignaturePolicyPath: "", - Writer: writer, - ManifestMIMEType: manifestType, - ForceCompress: c.Bool("compress"), - } - // only one image is supported for now // future pull requests will fix this for _, image := range args { @@ -119,7 +113,11 @@ func saveCmd(c *cli.Context) error { if strings.Contains(dst, libpod.OCIArchive) || strings.Contains(dst, libpod.DockerArchive) { dest = dst + ":" + image } - if err := runtime.PushImage(image, dest, saveOpts); err != nil { + newImage, err := runtime.ImageRuntime().NewFromLocal(image) + if err != nil { + return err + } + if err := newImage.PushImage(dest, manifestType, "", "", writer, c.Bool("compress"), libpodImage.SigningOptions{}, &libpodImage.DockerRegistryOptions{}); err != nil { if err2 := os.Remove(output); err2 != nil { logrus.Errorf("error deleting %q: %v", output, err) } |