Merge pull request #2160 from baude/localRuntimerename

Rename localRuntime to runtime in cmd/podman
This commit is contained in:
OpenShift Merge Robot
2019-01-15 09:13:44 -08:00
committed by GitHub
5 changed files with 19 additions and 19 deletions

View File

@ -67,12 +67,12 @@ func imageExistsCmd(c *cli.Context) error {
if len(args) > 1 || len(args) < 1 { if len(args) > 1 || len(args) < 1 {
return errors.New("you may only check for the existence of one image at a time") return errors.New("you may only check for the existence of one image at a time")
} }
localRuntime, err := adapter.GetRuntime(c) runtime, err := adapter.GetRuntime(c)
if err != nil { if err != nil {
return errors.Wrapf(err, "could not get runtime") return errors.Wrapf(err, "could not get runtime")
} }
defer localRuntime.Runtime.Shutdown(false) defer runtime.Runtime.Shutdown(false)
if _, err := localRuntime.NewImageFromLocal(args[0]); err != nil { if _, err := runtime.NewImageFromLocal(args[0]); err != nil {
//TODO we need to ask about having varlink defined errors exposed //TODO we need to ask about having varlink defined errors exposed
//so we can reuse them //so we can reuse them
if errors.Cause(err) == image.ErrNoSuchImage || err.Error() == "io.podman.ImageNotFound" { if errors.Cause(err) == image.ErrNoSuchImage || err.Error() == "io.podman.ImageNotFound" {

View File

@ -152,13 +152,13 @@ func imagesCmd(c *cli.Context) error {
return err return err
} }
localRuntime, err := adapter.GetRuntime(c) runtime, err := adapter.GetRuntime(c)
if err != nil { if err != nil {
return errors.Wrapf(err, "Could not get runtime") return errors.Wrapf(err, "Could not get runtime")
} }
defer localRuntime.Runtime.Shutdown(false) defer runtime.Runtime.Shutdown(false)
if len(c.Args()) == 1 { if len(c.Args()) == 1 {
newImage, err = localRuntime.NewImageFromLocal(c.Args().Get(0)) newImage, err = runtime.NewImageFromLocal(c.Args().Get(0))
if err != nil { if err != nil {
return err return err
} }
@ -171,7 +171,7 @@ func imagesCmd(c *cli.Context) error {
ctx := getContext() ctx := getContext()
if len(c.StringSlice("filter")) > 0 || newImage != nil { if len(c.StringSlice("filter")) > 0 || newImage != nil {
filterFuncs, err = CreateFilterFuncs(ctx, localRuntime, c, newImage) filterFuncs, err = CreateFilterFuncs(ctx, runtime, c, newImage)
if err != nil { if err != nil {
return err return err
} }
@ -195,7 +195,7 @@ func imagesCmd(c *cli.Context) error {
children to the image once built. until buildah supports caching builds, children to the image once built. until buildah supports caching builds,
it will not generate these intermediate images. it will not generate these intermediate images.
*/ */
images, err := localRuntime.GetImages() images, err := runtime.GetImages()
if err != nil { if err != nil {
return errors.Wrapf(err, "unable to get images") return errors.Wrapf(err, "unable to get images")
} }

View File

@ -39,20 +39,20 @@ func infoCmd(c *cli.Context) error {
} }
info := map[string]interface{}{} info := map[string]interface{}{}
localRuntime, err := adapter.GetRuntime(c) runtime, err := adapter.GetRuntime(c)
if err != nil { if err != nil {
return errors.Wrapf(err, "could not get runtime") return errors.Wrapf(err, "could not get runtime")
} }
defer localRuntime.Runtime.Shutdown(false) defer runtime.Runtime.Shutdown(false)
infoArr, err := localRuntime.Runtime.Info() infoArr, err := runtime.Runtime.Info()
if err != nil { if err != nil {
return errors.Wrapf(err, "error getting info") return errors.Wrapf(err, "error getting info")
} }
// TODO This is no a problem child because we don't know if we should add information // TODO This is no a problem child because we don't know if we should add information
// TODO about the client or the backend. Only do for traditional podman for now. // TODO about the client or the backend. Only do for traditional podman for now.
if !localRuntime.Remote && c.Bool("debug") { if !runtime.Remote && c.Bool("debug") {
debugInfo := debugInfo(c) debugInfo := debugInfo(c)
infoArr = append(infoArr, libpod.InfoData{Type: "debug", Data: debugInfo}) infoArr = append(infoArr, libpod.InfoData{Type: "debug", Data: debugInfo})
} }

View File

@ -64,11 +64,11 @@ specified, the image with the 'latest' tag (if it exists) is pulled
// pullCmd gets the data from the command line and calls pullImage // pullCmd gets the data from the command line and calls pullImage
// to copy an image from a registry to a local machine // to copy an image from a registry to a local machine
func pullCmd(c *cli.Context) error { func pullCmd(c *cli.Context) error {
localRuntime, err := adapter.GetRuntime(c) runtime, err := adapter.GetRuntime(c)
if err != nil { if err != nil {
return errors.Wrapf(err, "could not get runtime") return errors.Wrapf(err, "could not get runtime")
} }
defer localRuntime.Runtime.Shutdown(false) defer runtime.Runtime.Shutdown(false)
args := c.Args() args := c.Args()
if len(args) == 0 { if len(args) == 0 {
@ -116,14 +116,14 @@ func pullCmd(c *cli.Context) error {
if err != nil { if err != nil {
return errors.Wrapf(err, "error parsing %q", image) return errors.Wrapf(err, "error parsing %q", image)
} }
newImage, err := localRuntime.LoadFromArchiveReference(getContext(), srcRef, c.String("signature-policy"), writer) newImage, err := runtime.LoadFromArchiveReference(getContext(), srcRef, c.String("signature-policy"), writer)
if err != nil { if err != nil {
return errors.Wrapf(err, "error pulling image from %q", image) return errors.Wrapf(err, "error pulling image from %q", image)
} }
imgID = newImage[0].ID() imgID = newImage[0].ID()
} else { } else {
authfile := getAuthFile(c.String("authfile")) authfile := getAuthFile(c.String("authfile"))
newImage, err := localRuntime.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)
if err != nil { if err != nil {
return errors.Wrapf(err, "error pulling image %q", image) return errors.Wrapf(err, "error pulling image %q", image)
} }

View File

@ -23,13 +23,13 @@ func tagCmd(c *cli.Context) error {
if len(args) < 2 { if len(args) < 2 {
return errors.Errorf("image name and at least one new name must be specified") return errors.Errorf("image name and at least one new name must be specified")
} }
localRuntime, err := adapter.GetRuntime(c) runtime, err := adapter.GetRuntime(c)
if err != nil { if err != nil {
return errors.Wrapf(err, "could not create runtime") return errors.Wrapf(err, "could not create runtime")
} }
defer localRuntime.Runtime.Shutdown(false) defer runtime.Runtime.Shutdown(false)
newImage, err := localRuntime.NewImageFromLocal(args[0]) newImage, err := runtime.NewImageFromLocal(args[0])
if err != nil { if err != nil {
return err return err
} }