From 8500ce6b9ab0050b925ec3b899495cb2cc8d367f Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 31 Mar 2020 12:59:08 -0500 Subject: podmanv2 load enable podman load for v2 add reexec into main add systemd build flag to v2 makefile Signed-off-by: Brent Baude --- pkg/domain/infra/abi/images.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pkg/domain/infra/abi/images.go') diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 5a7acb2f7..c3a2bb288 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -315,3 +315,24 @@ func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string } return nil } + +func (ir *ImageEngine) Load(ctx context.Context, opts entities.ImageLoadOptions) (*entities.ImageLoadReport, error) { + var ( + writer io.Writer + ) + if !opts.Quiet { + writer = os.Stderr + } + name, err := ir.Libpod.LoadImage(ctx, opts.Name, opts.Input, writer, opts.SignaturePolicy) + if err != nil { + return nil, err + } + newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(name) + if err != nil { + return nil, errors.Wrap(err, "image loaded but no additional tags were created") + } + if err := newImage.TagImage(opts.Name); err != nil { + return nil, errors.Wrapf(err, "error adding %q to image %q", opts.Name, newImage.InputName) + } + return &entities.ImageLoadReport{Name: name}, nil +} -- cgit v1.2.3-54-g00ecf