diff options
author | baude <bbaude@redhat.com> | 2019-01-11 10:33:25 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-01-30 08:44:58 -0600 |
commit | 735f0de6336fa8db7465ce4aaa5b6de203816aa9 (patch) | |
tree | 25ec04f14357a7a65aed89b3ca5d5a33c45d6ef5 /cmd | |
parent | b71088a01e1e43b87214aaca87c73865fa3b990e (diff) | |
download | podman-735f0de6336fa8db7465ce4aaa5b6de203816aa9.tar.gz podman-735f0de6336fa8db7465ce4aaa5b6de203816aa9.tar.bz2 podman-735f0de6336fa8db7465ce4aaa5b6de203816aa9.zip |
Changes to container runlabel for toolbox project
The toolbox project would benefit from a few changes to more closely
resembe the original atomic cli project. Changes made are:
* only pull image for container runlabel if the label exists in the image
* if a container image does not have the desired label, exit with non-zero
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/create.go | 2 | ||||
-rw-r--r-- | cmd/podman/play_kube.go | 2 | ||||
-rw-r--r-- | cmd/podman/pull.go | 2 | ||||
-rw-r--r-- | cmd/podman/runlabel.go | 2 | ||||
-rw-r--r-- | cmd/podman/shared/container.go | 2 | ||||
-rw-r--r-- | cmd/podman/sign.go | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index c56efa153..2d85abd35 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -134,7 +134,7 @@ func createContainer(c *cli.Context, runtime *libpod.Runtime) (*libpod.Container writer = os.Stderr } - newImage, err := runtime.ImageRuntime().New(ctx, c.Args()[0], rtc.SignaturePolicyPath, "", writer, nil, image.SigningOptions{}, false) + newImage, err := runtime.ImageRuntime().New(ctx, c.Args()[0], rtc.SignaturePolicyPath, "", writer, nil, image.SigningOptions{}, false, nil) if err != nil { return nil, nil, err } diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go index 2ce2e21bb..4753dd0a6 100644 --- a/cmd/podman/play_kube.go +++ b/cmd/podman/play_kube.go @@ -146,7 +146,7 @@ func playKubeYAMLCmd(c *cli.Context) error { } for _, container := range podYAML.Spec.Containers { - newImage, err := runtime.ImageRuntime().New(ctx, container.Image, c.String("signature-policy"), c.String("authfile"), writer, &dockerRegistryOptions, image2.SigningOptions{}, false) + newImage, err := runtime.ImageRuntime().New(ctx, container.Image, c.String("signature-policy"), c.String("authfile"), writer, &dockerRegistryOptions, image2.SigningOptions{}, false, nil) if err != nil { return err } diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index 2a78d0c54..f70e5cded 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -123,7 +123,7 @@ func pullCmd(c *cli.Context) error { imgID = newImage[0].ID() } else { authfile := getAuthFile(c.String("authfile")) - newImage, err := runtime.New(getContext(), image, c.String("signature-policy"), authfile, writer, &dockerRegistryOptions, image2.SigningOptions{}, true) + newImage, err := runtime.New(getContext(), image, c.String("signature-policy"), authfile, writer, &dockerRegistryOptions, image2.SigningOptions{}, true, nil) if err != nil { return errors.Wrapf(err, "error pulling image %q", image) } diff --git a/cmd/podman/runlabel.go b/cmd/podman/runlabel.go index 48a296260..b16a93fd9 100644 --- a/cmd/podman/runlabel.go +++ b/cmd/podman/runlabel.go @@ -166,7 +166,7 @@ func runlabelCmd(c *cli.Context) error { return err } if runLabel == "" { - return nil + return errors.Errorf("%s does not have a label of %s", runlabelImage, label) } cmd, env, err := shared.GenerateRunlabelCommand(runLabel, imageName, c.String("name"), opts, extraArgs) diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index 9040c4a5c..f84fb8261 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -609,7 +609,7 @@ func GetRunlabel(label string, runlabelImage string, ctx context.Context, runtim registryCreds = creds } dockerRegistryOptions.DockerRegistryCreds = registryCreds - newImage, err = runtime.ImageRuntime().New(ctx, runlabelImage, signaturePolicyPath, authfile, output, &dockerRegistryOptions, image.SigningOptions{}, false) + newImage, err = runtime.ImageRuntime().New(ctx, runlabelImage, signaturePolicyPath, authfile, output, &dockerRegistryOptions, image.SigningOptions{}, false, &label) } else { newImage, err = runtime.ImageRuntime().NewFromLocal(runlabelImage) } diff --git a/cmd/podman/sign.go b/cmd/podman/sign.go index 1d9aecdc9..22aa07230 100644 --- a/cmd/podman/sign.go +++ b/cmd/podman/sign.go @@ -104,7 +104,7 @@ func signCmd(c *cli.Context) error { } // create the signstore file - newImage, err := runtime.ImageRuntime().New(getContext(), signimage, runtime.GetConfig().SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{SignBy: signby}, false) + newImage, err := runtime.ImageRuntime().New(getContext(), signimage, runtime.GetConfig().SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{SignBy: signby}, false, nil) if err != nil { return errors.Wrapf(err, "error pulling image %s", signimage) } |