summaryrefslogtreecommitdiff
path: root/libpod/adapter
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-21 18:29:47 +0100
committerGitHub <noreply@github.com>2019-02-21 18:29:47 +0100
commitb4c10790d514538277a937a443219e4310cb057f (patch)
tree9b3614c1c806dca4bf4745448d9e57c82d6fe2d3 /libpod/adapter
parentaf922fb2c6baceb89cc8e4acd6d84a6474b32dda (diff)
parent71db80ddb15addb4197693bc056c35dd8ff0d6ac (diff)
downloadpodman-b4c10790d514538277a937a443219e4310cb057f.tar.gz
podman-b4c10790d514538277a937a443219e4310cb057f.tar.bz2
podman-b4c10790d514538277a937a443219e4310cb057f.zip
Merge pull request #2385 from baude/remoteload
podman-remote load image
Diffstat (limited to 'libpod/adapter')
-rw-r--r--libpod/adapter/runtime.go11
-rw-r--r--libpod/adapter/runtime_remote.go37
2 files changed, 46 insertions, 2 deletions
diff --git a/libpod/adapter/runtime.go b/libpod/adapter/runtime.go
index b12f63cdc..4f5b98dbb 100644
--- a/libpod/adapter/runtime.go
+++ b/libpod/adapter/runtime.go
@@ -322,3 +322,14 @@ func (r *LocalRuntime) SaveImage(ctx context.Context, c *cliconfig.SaveValues) e
}
return newImage.Save(ctx, source, c.Format, c.Output, additionalTags, c.Quiet, c.Compress)
}
+
+// LoadImage is a wrapper function for libpod PruneVolumes
+func (r *LocalRuntime) LoadImage(ctx context.Context, name string, cli *cliconfig.LoadValues) (string, error) {
+ var (
+ writer io.Writer
+ )
+ if !cli.Quiet {
+ writer = os.Stderr
+ }
+ return r.Runtime.LoadImage(ctx, name, cli.Input, writer, cli.SignaturePolicy)
+}
diff --git a/libpod/adapter/runtime_remote.go b/libpod/adapter/runtime_remote.go
index a79f93079..ca2fad852 100644
--- a/libpod/adapter/runtime_remote.go
+++ b/libpod/adapter/runtime_remote.go
@@ -486,7 +486,7 @@ func (r *LocalRuntime) Build(ctx context.Context, c *cliconfig.BuildValues, opti
if err != nil {
return err
}
- buildinfo.ContextDir = strings.Replace(tempFile, ":", "", -1)
+ buildinfo.ContextDir = tempFile
reply, err := iopodman.BuildImage().Send(r.Conn, varlink.More, buildinfo)
if err != nil {
@@ -549,7 +549,7 @@ func (r *LocalRuntime) SendFileOverVarlink(source string) (string, error) {
}
- return tempFile, nil
+ return strings.Replace(tempFile, ":", "", -1), nil
}
// GetAllVolumes retrieves all the volumes
@@ -763,3 +763,36 @@ func (r *LocalRuntime) SaveImage(ctx context.Context, c *cliconfig.SaveValues) e
}
return nil
}
+
+// LoadImage loads a container image from a remote client's filesystem
+func (r *LocalRuntime) LoadImage(ctx context.Context, name string, cli *cliconfig.LoadValues) (string, error) {
+ var names string
+ remoteTempFile, err := r.SendFileOverVarlink(cli.Input)
+ if err != nil {
+ return "", nil
+ }
+ more := varlink.More
+ if cli.Quiet {
+ more = 0
+ }
+ reply, err := iopodman.LoadImage().Send(r.Conn, uint64(more), name, remoteTempFile, cli.Quiet, true)
+ if err != nil {
+ return "", err
+ }
+
+ for {
+ responses, flags, err := reply()
+ if err != nil {
+ logrus.Error(err)
+ return "", err
+ }
+ for _, line := range responses.Logs {
+ fmt.Print(line)
+ }
+ names = responses.Id
+ if flags&varlink.Continues == 0 {
+ break
+ }
+ }
+ return names, nil
+}