diff options
author | baude <bbaude@redhat.com> | 2018-03-15 10:06:49 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-20 16:20:12 +0000 |
commit | 38a1b2f16d210525eafcc845e7a9cce598207113 (patch) | |
tree | 5616a12d68ebe55138fbde85f936a6bc90d4c8fd /cmd/podman/import.go | |
parent | ecfa321288f10b70a59166f93296c77d262317fc (diff) | |
download | podman-38a1b2f16d210525eafcc845e7a9cce598207113.tar.gz podman-38a1b2f16d210525eafcc845e7a9cce598207113.tar.bz2 podman-38a1b2f16d210525eafcc845e7a9cce598207113.zip |
Image library stage 4 - create and commit
Migrate the podman create and commit subcommandis to leverage the images library. I also had
to migrate the cmd/ portions of run and rmi.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #498
Approved by: mheon
Diffstat (limited to 'cmd/podman/import.go')
-rw-r--r-- | cmd/podman/import.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cmd/podman/import.go b/cmd/podman/import.go index d3c497d9d..6f7565b4b 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -11,7 +11,7 @@ import ( "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" - "github.com/projectatomic/libpod/libpod" + "github.com/projectatomic/libpod/libpod/image" "github.com/urfave/cli" ) @@ -55,8 +55,12 @@ func importCmd(c *cli.Context) error { } defer runtime.Shutdown(false) - var opts libpod.CopyOptions - var source string + var ( + source string + reference string + writer io.Writer + ) + args := c.Args() switch len(args) { case 0: @@ -65,7 +69,7 @@ func importCmd(c *cli.Context) error { source = args[0] case 2: source = args[0] - opts.Reference = args[1] + reference = args[1] default: return errors.Errorf("too many arguments. Usage TARBALL [REFERENCE]") } @@ -87,11 +91,9 @@ func importCmd(c *cli.Context) error { History: history, } - opts.ImageConfig = config - opts.Writer = nil - + writer = nil if !c.Bool("quiet") { - opts.Writer = os.Stderr + writer = os.Stderr } // if source is a url, download it and save to a temp file @@ -105,9 +107,9 @@ func importCmd(c *cli.Context) error { source = file } - img, err := runtime.ImportImage(source, opts) + newImage, err := runtime.Import(source, reference, writer, image.SigningOptions{}, config) if err == nil { - fmt.Println(img.ID) + fmt.Println(newImage.ID()) } return err } |