From 043308198337941a8086113619d6341528c10cd0 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 31 Mar 2020 14:45:19 -0500 Subject: podmanv2 import add the ability to import a container image from a container export Signed-off-by: Brent Baude --- pkg/domain/infra/tunnel/images.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg/domain/infra/tunnel') diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index a4a0fccaf..155f5e4bd 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -167,3 +167,20 @@ func (ir *ImageEngine) Load(ctx context.Context, opts entities.ImageLoadOptions) defer f.Close() return images.Load(ir.ClientCxt, f, &opts.Name) } + +func (ir *ImageEngine) Import(ctx context.Context, opts entities.ImageImportOptions) (*entities.ImageImportReport, error) { + var ( + err error + sourceURL *string + f *os.File + ) + if opts.SourceIsURL { + sourceURL = &opts.Source + } else { + f, err = os.Open(opts.Source) + if err != nil { + return nil, err + } + } + return images.Import(ir.ClientCxt, opts.Changes, &opts.Message, &opts.Reference, sourceURL, f) +} -- cgit v1.2.3-54-g00ecf