diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-01 22:54:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-01 22:54:22 +0200 |
commit | 0f357be5aeaa5dc651659cf0945a58780641e77d (patch) | |
tree | 77c502c42324db5aa5635b65f615c6a3c4e96fde /pkg/domain/infra/abi/images.go | |
parent | 0a163720351710be314c729086e8d288680ff0a8 (diff) | |
parent | 8500ce6b9ab0050b925ec3b899495cb2cc8d367f (diff) | |
download | podman-0f357be5aeaa5dc651659cf0945a58780641e77d.tar.gz podman-0f357be5aeaa5dc651659cf0945a58780641e77d.tar.bz2 podman-0f357be5aeaa5dc651659cf0945a58780641e77d.zip |
Merge pull request #5686 from baude/v2load
podmanv2 load
Diffstat (limited to 'pkg/domain/infra/abi/images.go')
-rw-r--r-- | pkg/domain/infra/abi/images.go | 21 |
1 files changed, 21 insertions, 0 deletions
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 +} |