diff options
Diffstat (limited to 'pkg/adapter')
-rw-r--r-- | pkg/adapter/images.go | 5 | ||||
-rw-r--r-- | pkg/adapter/images_remote.go | 7 | ||||
-rw-r--r-- | pkg/adapter/runtime.go | 10 | ||||
-rw-r--r-- | pkg/adapter/runtime_remote.go | 14 |
4 files changed, 17 insertions, 19 deletions
diff --git a/pkg/adapter/images.go b/pkg/adapter/images.go index c8ea1cdea..762f1a656 100644 --- a/pkg/adapter/images.go +++ b/pkg/adapter/images.go @@ -3,14 +3,13 @@ package adapter import ( - "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/libpod/image" "github.com/pkg/errors" ) // Tree ... -func (r *LocalRuntime) Tree(c *cliconfig.TreeValues) (*image.InfoImage, map[string]*image.LayerInfo, *ContainerImage, error) { - img, err := r.NewImageFromLocal(c.InputArgs[0]) +func (r *LocalRuntime) Tree(imageOrID string) (*image.InfoImage, map[string]*image.LayerInfo, *ContainerImage, error) { + img, err := r.NewImageFromLocal(imageOrID) if err != nil { return nil, nil, nil, err } diff --git a/pkg/adapter/images_remote.go b/pkg/adapter/images_remote.go index 722058d4a..1d4997d9a 100644 --- a/pkg/adapter/images_remote.go +++ b/pkg/adapter/images_remote.go @@ -6,7 +6,6 @@ import ( "context" "encoding/json" - "github.com/containers/libpod/cmd/podman/cliconfig" iopodman "github.com/containers/libpod/cmd/podman/varlink" "github.com/containers/libpod/libpod/image" "github.com/containers/libpod/pkg/inspect" @@ -27,11 +26,11 @@ func (i *ContainerImage) Inspect(ctx context.Context) (*inspect.ImageData, error } // Tree ... -func (r *LocalRuntime) Tree(c *cliconfig.TreeValues) (*image.InfoImage, map[string]*image.LayerInfo, *ContainerImage, error) { +func (r *LocalRuntime) Tree(imageOrID string) (*image.InfoImage, map[string]*image.LayerInfo, *ContainerImage, error) { layerInfoMap := make(map[string]*image.LayerInfo) imageInfo := &image.InfoImage{} - img, err := r.NewImageFromLocal(c.InputArgs[0]) + img, err := r.NewImageFromLocal(imageOrID) if err != nil { return nil, nil, nil, err } @@ -44,7 +43,7 @@ func (r *LocalRuntime) Tree(c *cliconfig.TreeValues) (*image.InfoImage, map[stri return nil, nil, nil, errors.Wrap(err, "failed to unmarshal image layers") } - reply, err = iopodman.BuildImageHierarchyMap().Call(r.Conn, c.InputArgs[0]) + reply, err = iopodman.BuildImageHierarchyMap().Call(r.Conn, imageOrID) if err != nil { return nil, nil, nil, errors.Wrap(err, "failed to get build image map") } diff --git a/pkg/adapter/runtime.go b/pkg/adapter/runtime.go index 8933e826f..5f880e807 100644 --- a/pkg/adapter/runtime.go +++ b/pkg/adapter/runtime.go @@ -286,20 +286,20 @@ func libpodVolumeToVolume(volumes []*libpod.Volume) []*Volume { } // Build is the wrapper to build images -func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, options imagebuildah.BuildOptions, dockerfiles []string) error { +func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, options imagebuildah.BuildOptions, dockerfiles []string) (string, reference.Canonical, error) { namespaceOptions, networkPolicy, err := parse.NamespaceOptions(c.PodmanCommand.Command) if err != nil { - return errors.Wrapf(err, "error parsing namespace-related options") + return "", nil, errors.Wrapf(err, "error parsing namespace-related options") } usernsOption, idmappingOptions, err := parse.IDMappingOptions(c.PodmanCommand.Command, options.Isolation) if err != nil { - return errors.Wrapf(err, "error parsing ID mapping options") + return "", nil, errors.Wrapf(err, "error parsing ID mapping options") } namespaceOptions.AddOrReplace(usernsOption...) systemContext, err := parse.SystemContextFromOptions(c.PodmanCommand.Command) if err != nil { - return errors.Wrapf(err, "error building system context") + return "", nil, errors.Wrapf(err, "error building system context") } authfile := c.Authfile @@ -310,7 +310,7 @@ func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, opti systemContext.AuthFilePath = authfile commonOpts, err := parse.CommonBuildOptions(c.PodmanCommand.Command) if err != nil { - return err + return "", nil, err } options.NamespaceOptions = namespaceOptions diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index 9c10b31c0..c908358ff 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -507,7 +507,7 @@ func (r *LocalRuntime) Import(ctx context.Context, source, reference string, cha return iopodman.ImportImage().Call(r.Conn, strings.TrimRight(tempFile, ":"), reference, history, changes, true) } -func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, options imagebuildah.BuildOptions, dockerfiles []string) error { +func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, options imagebuildah.BuildOptions, dockerfiles []string) (string, reference.Canonical, error) { buildOptions := iopodman.BuildOptions{ AddHosts: options.CommonBuildOpts.AddHost, CgroupParent: options.CommonBuildOpts.CgroupParent, @@ -552,31 +552,31 @@ func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, opti // tar the file outputFile, err := ioutil.TempFile("", "varlink_tar_send") if err != nil { - return err + return "", nil, err } defer outputFile.Close() defer os.Remove(outputFile.Name()) // Create the tarball of the context dir to a tempfile if err := utils.TarToFilesystem(options.ContextDirectory, outputFile); err != nil { - return err + return "", nil, err } // Send the context dir tarball over varlink. tempFile, err := r.SendFileOverVarlink(outputFile.Name()) if err != nil { - return err + return "", nil, err } buildinfo.ContextDir = tempFile reply, err := iopodman.BuildImage().Send(r.Conn, varlink.More, buildinfo) if err != nil { - return err + return "", nil, err } for { responses, flags, err := reply() if err != nil { - return err + return "", nil, err } for _, line := range responses.Logs { fmt.Print(line) @@ -585,7 +585,7 @@ func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, opti break } } - return err + return "", nil, err } // SendFileOverVarlink sends a file over varlink in an upgraded connection |