Move libkpod/image libkpod/layer to libpod/images and libpod/layers

Begin moving image and layer handling out of libkpod into libpod.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2017-08-31 11:17:21 -04:00
parent 47ef2f66df
commit e18e962238
26 changed files with 272 additions and 104 deletions

View file

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/storage"
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/kubernetes-incubator/cri-o/libpod/images"
"github.com/pkg/errors"
"github.com/urfave/cli"
)
@ -49,7 +49,7 @@ func rmiCmd(c *cli.Context) error {
}
for _, id := range args {
image, err := libkpodimage.FindImage(store, id)
image, err := images.FindImage(store, id)
if err != nil {
return errors.Wrapf(err, "could not get image %q", id)
}
@ -68,14 +68,14 @@ func rmiCmd(c *cli.Context) error {
}
}
// If the user supplied an ID, we cannot delete the image if it is referred to by multiple tags
if libkpodimage.MatchesID(image.ID, id) {
if images.MatchesID(image.ID, id) {
if len(image.Names) > 1 && !force {
return fmt.Errorf("unable to delete %s (must force) - image is referred to in multiple tags", image.ID)
}
// If it is forced, we have to untag the image so that it can be deleted
image.Names = image.Names[:0]
} else {
name, err2 := libkpodimage.UntagImage(store, image, id)
name, err2 := images.UntagImage(store, image, id)
if err2 != nil {
return err
}
@ -85,7 +85,7 @@ func rmiCmd(c *cli.Context) error {
if len(image.Names) > 0 {
continue
}
id, err := libkpodimage.RemoveImage(image, store)
id, err := images.RemoveImage(image, store)
if err != nil {
return err
}