diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-02 14:20:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 14:20:57 +0200 |
commit | 82610d657d58b3da68c5af35cef7470b0819636b (patch) | |
tree | 3ebb74110eb8ab718c23d4fa6312b67f226258e0 /pkg/domain/infra/tunnel | |
parent | 88455fe704023d65b782e70fc774128b3ec76569 (diff) | |
parent | 043308198337941a8086113619d6341528c10cd0 (diff) | |
download | podman-82610d657d58b3da68c5af35cef7470b0819636b.tar.gz podman-82610d657d58b3da68c5af35cef7470b0819636b.tar.bz2 podman-82610d657d58b3da68c5af35cef7470b0819636b.zip |
Merge pull request #5688 from baude/v2import
podmanv2 import
Diffstat (limited to 'pkg/domain/infra/tunnel')
-rw-r--r-- | pkg/domain/infra/tunnel/images.go | 17 |
1 files changed, 17 insertions, 0 deletions
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) +} |