From 6b0ac2301beb3c9cfbb8af89e9964465a890fd22 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 28 Mar 2019 20:00:29 -0400 Subject: Cleanup image2 -> image for imports Remove references to image2 in source code. Makes the code slightly more readable. Signed-off-by: Daniel J Walsh --- cmd/podman/play_kube.go | 8 ++++---- cmd/podman/pull.go | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/play_kube.go b/cmd/podman/play_kube.go index 10221a339..e9f0acaa1 100644 --- a/cmd/podman/play_kube.go +++ b/cmd/podman/play_kube.go @@ -13,7 +13,7 @@ import ( "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/libpod/cmd/podman/shared" "github.com/containers/libpod/libpod" - image2 "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/libpod/image" ns "github.com/containers/libpod/pkg/namespaces" "github.com/containers/libpod/pkg/rootless" "github.com/containers/libpod/pkg/spec" @@ -145,7 +145,7 @@ func playKubeYAMLCmd(c *cliconfig.KubePlayValues) error { writer = os.Stderr } - dockerRegistryOptions := image2.DockerRegistryOptions{ + dockerRegistryOptions := image.DockerRegistryOptions{ DockerRegistryCreds: registryCreds, DockerCertPath: c.CertDir, } @@ -183,7 +183,7 @@ func playKubeYAMLCmd(c *cliconfig.KubePlayValues) error { } for _, container := range podYAML.Spec.Containers { - newImage, err := runtime.ImageRuntime().New(ctx, container.Image, c.SignaturePolicy, c.Authfile, writer, &dockerRegistryOptions, image2.SigningOptions{}, false, nil) + newImage, err := runtime.ImageRuntime().New(ctx, container.Image, c.SignaturePolicy, c.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, false, nil) if err != nil { return err } @@ -232,7 +232,7 @@ func getPodPorts(containers []v1.Container) []ocicni.PortMapping { } // kubeContainerToCreateConfig takes a v1.Container and returns a createconfig describing a container -func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container, runtime *libpod.Runtime, newImage *image2.Image, namespaces map[string]string, volumes map[string]string) (*createconfig.CreateConfig, error) { +func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container, runtime *libpod.Runtime, newImage *image.Image, namespaces map[string]string, volumes map[string]string) (*createconfig.CreateConfig, error) { var ( containerConfig createconfig.CreateConfig envs map[string]string diff --git a/cmd/podman/pull.go b/cmd/podman/pull.go index eeb9f3ff3..2aac28642 100644 --- a/cmd/podman/pull.go +++ b/cmd/podman/pull.go @@ -11,7 +11,7 @@ import ( "github.com/containers/image/transports/alltransports" "github.com/containers/image/types" "github.com/containers/libpod/cmd/podman/cliconfig" - image2 "github.com/containers/libpod/libpod/image" + "github.com/containers/libpod/libpod/image" "github.com/containers/libpod/pkg/adapter" "github.com/containers/libpod/pkg/util" opentracing "github.com/opentracing/opentracing-go" @@ -85,7 +85,7 @@ func pullCmd(c *cliconfig.PullValues) error { } } ctx := getContext() - image := args[0] + img := args[0] var registryCreds *types.DockerAuthConfig @@ -104,7 +104,7 @@ func pullCmd(c *cliconfig.PullValues) error { writer = os.Stderr } - dockerRegistryOptions := image2.DockerRegistryOptions{ + dockerRegistryOptions := image.DockerRegistryOptions{ DockerRegistryCreds: registryCreds, DockerCertPath: c.CertDir, } @@ -113,20 +113,20 @@ func pullCmd(c *cliconfig.PullValues) error { } // Possible for docker-archive to have multiple tags, so use LoadFromArchiveReference instead - if strings.HasPrefix(image, dockerarchive.Transport.Name()+":") { - srcRef, err := alltransports.ParseImageName(image) + if strings.HasPrefix(img, dockerarchive.Transport.Name()+":") { + srcRef, err := alltransports.ParseImageName(img) if err != nil { - return errors.Wrapf(err, "error parsing %q", image) + return errors.Wrapf(err, "error parsing %q", img) } newImage, err := runtime.LoadFromArchiveReference(getContext(), srcRef, c.SignaturePolicy, writer) if err != nil { - return errors.Wrapf(err, "error pulling image from %q", image) + return errors.Wrapf(err, "error pulling image from %q", img) } fmt.Println(newImage[0].ID()) } else { authfile := getAuthFile(c.String("authfile")) - spec := image - systemContext := image2.GetSystemContext("", authfile, false) + spec := img + systemContext := image.GetSystemContext("", authfile, false) srcRef, err := alltransports.ParseImageName(spec) if err != nil { dockerTransport := "docker://" @@ -134,7 +134,7 @@ func pullCmd(c *cliconfig.PullValues) error { spec = dockerTransport + spec srcRef2, err2 := alltransports.ParseImageName(spec) if err2 != nil { - return errors.Wrapf(err2, "error parsing image name %q", image) + return errors.Wrapf(err2, "error parsing image name %q", img) } srcRef = srcRef2 } @@ -157,7 +157,7 @@ func pullCmd(c *cliconfig.PullValues) error { var foundIDs []string foundImage := true for _, name := range names { - newImage, err := runtime.New(getContext(), name, c.String("signature-policy"), authfile, writer, &dockerRegistryOptions, image2.SigningOptions{}, true, nil) + newImage, err := runtime.New(getContext(), name, c.String("signature-policy"), authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, true, nil) if err != nil { println(errors.Wrapf(err, "error pulling image %q", name)) foundImage = false @@ -166,7 +166,7 @@ func pullCmd(c *cliconfig.PullValues) error { foundIDs = append(foundIDs, newImage.ID()) } if len(names) == 1 && !foundImage { - return errors.Wrapf(err, "error pulling image %q", image) + return errors.Wrapf(err, "error pulling image %q", img) } if len(names) > 1 { fmt.Println("Pulled Images:") @@ -174,6 +174,6 @@ func pullCmd(c *cliconfig.PullValues) error { for _, id := range foundIDs { fmt.Println(id) } - } // end else if strings.HasPrefix(image, dockerarchive.Transport.Name()+":") + } // end else if strings.HasPrefix(img, dockerarchive.Transport.Name()+":") return nil } -- cgit v1.2.3-54-g00ecf