diff options
-rw-r--r-- | cmd/podman/create.go | 2 | ||||
-rw-r--r-- | cmd/podman/load.go | 6 | ||||
-rw-r--r-- | cmd/podman/pull.go | 2 | ||||
-rw-r--r-- | cmd/podman/run.go | 2 | ||||
-rw-r--r-- | libpod/image/image.go | 14 | ||||
-rw-r--r-- | libpod/image/image_test.go | 8 |
6 files changed, 18 insertions, 16 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 8bf61a2ca..a1d3ead20 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -181,7 +181,7 @@ func createCmd(c *cli.Context) error { rtc := runtime.GetConfig() - newImage, err := runtime.ImageRuntime().New(c.Args()[0], rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}) + newImage, err := runtime.ImageRuntime().New(c.Args()[0], rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false) if err != nil { return err } diff --git a/cmd/podman/load.go b/cmd/podman/load.go index 8146f4c5d..941dd68d9 100644 --- a/cmd/podman/load.go +++ b/cmd/podman/load.go @@ -99,17 +99,17 @@ func loadCmd(c *cli.Context) error { } src := libpod.DockerArchive + ":" + input - newImage, err := runtime.ImageRuntime().New(src, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}) + newImage, err := runtime.ImageRuntime().New(src, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}, false) if err != nil { // generate full src name with specified image:tag fullSrc := libpod.OCIArchive + ":" + input if image != "" { fullSrc = fullSrc + ":" + image } - newImage, err = runtime.ImageRuntime().New(fullSrc, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}) + newImage, err = runtime.ImageRuntime().New(fullSrc, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}, false) if err != nil { src = libpod.DirTransport + ":" + input - newImage, err = runtime.ImageRuntime().New(src, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}) + newImage, err = runtime.ImageRuntime().New(src, c.String("signature-policy"), "", writer, &libpodImage.DockerRegistryOptions{}, libpodImage.SigningOptions{}, false) if err != nil { return errors.Wrapf(err, "error pulling %q", src) } diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 28d69cfdd..4ceae4596 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -99,7 +99,7 @@ func pullCmd(c *cli.Context) error { DockerInsecureSkipTLSVerify: !c.BoolT("tls-verify"), } - newImage, err := runtime.ImageRuntime().New(image, c.String("signature-policy"), c.String("authfile"), writer, &dockerRegistryOptions, image2.SigningOptions{}) + newImage, err := runtime.ImageRuntime().New(image, c.String("signature-policy"), c.String("authfile"), writer, &dockerRegistryOptions, image2.SigningOptions{}, true) if err != nil { return errors.Wrapf(err, "error pulling image %q", image) } diff --git a/cmd/podman/run.go b/cmd/podman/run.go index cafb16d9d..da506c2bd 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -56,7 +56,7 @@ func runCmd(c *cli.Context) error { } rtc := runtime.GetConfig() - newImage, err := runtime.ImageRuntime().New(c.Args()[0], rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}) + newImage, err := runtime.ImageRuntime().New(c.Args()[0], rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false) if err != nil { return errors.Wrapf(err, "unable to find image") } diff --git a/libpod/image/image.go b/libpod/image/image.go index 009c51886..89da71cb6 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -117,18 +117,20 @@ func (ir *Runtime) NewFromLocal(name string) (*Image, error) { // New creates a new image object where the image could be local // or remote -func (ir *Runtime) New(name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *DockerRegistryOptions, signingoptions SigningOptions) (*Image, error) { +func (ir *Runtime) New(name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *DockerRegistryOptions, signingoptions SigningOptions, forcePull bool) (*Image, error) { // We don't know if the image is local or not ... check local first newImage := Image{ InputName: name, Local: false, imageruntime: ir, } - localImage, err := newImage.getLocalImage() - if err == nil { - newImage.Local = true - newImage.image = localImage - return &newImage, nil + if !forcePull { + localImage, err := newImage.getLocalImage() + if err == nil { + newImage.Local = true + newImage.image = localImage + return &newImage, nil + } } // The image is not local diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go index cb32b6cae..8c1138f71 100644 --- a/libpod/image/image_test.go +++ b/libpod/image/image_test.go @@ -81,9 +81,9 @@ func TestImage_NewFromLocal(t *testing.T) { // Need images to be present for this test ir, err := NewImageRuntimeFromOptions(so) assert.NoError(t, err) - bb, err := ir.New("docker.io/library/busybox:latest", "", "", writer, nil, SigningOptions{}) + bb, err := ir.New("docker.io/library/busybox:latest", "", "", writer, nil, SigningOptions{}, false) assert.NoError(t, err) - bbglibc, err := ir.New("docker.io/library/busybox:glibc", "", "", writer, nil, SigningOptions{}) + bbglibc, err := ir.New("docker.io/library/busybox:glibc", "", "", writer, nil, SigningOptions{}, false) assert.NoError(t, err) tm, err := makeLocalMatrix(bb, bbglibc) @@ -126,7 +126,7 @@ func TestImage_New(t *testing.T) { // Iterate over the names and delete the image // after the pull for _, img := range names { - newImage, err := ir.New(img, "", "", writer, nil, SigningOptions{}) + newImage, err := ir.New(img, "", "", writer, nil, SigningOptions{}, false) assert.NoError(t, err) assert.NotEqual(t, newImage.ID(), "") err = newImage.Remove(false) @@ -150,7 +150,7 @@ func TestImage_MatchRepoTag(t *testing.T) { } ir, err := NewImageRuntimeFromOptions(so) assert.NoError(t, err) - newImage, err := ir.New("busybox", "", "", os.Stdout, nil, SigningOptions{}) + newImage, err := ir.New("busybox", "", "", os.Stdout, nil, SigningOptions{}, false) assert.NoError(t, err) err = newImage.TagImage("foo:latest") assert.NoError(t, err) |