Return imageid from podman pull

When using podman to pull an image, print the image id after
the image is pulled.

Resolves issue #329

Signed-off-by: baude <bbaude@redhat.com>

Closes: #342
Approved by: rhatdan
This commit is contained in:
baude
2018-02-15 10:33:18 -06:00
committed by Atomic Bot
parent ce7a0171d1
commit 409ed259c6
3 changed files with 34 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"io"
"os"
"fmt"
"github.com/containers/image/types"
"github.com/pkg/errors"
"github.com/projectatomic/libpod/libpod"
@ -106,5 +107,13 @@ func pullCmd(c *cli.Context) error {
if _, err := runtime.PullImage(image, options); err != nil {
return errors.Wrapf(err, "error pulling image %q", image)
}
newImage := runtime.NewImage(image)
iid, err := newImage.GetImageID()
// Intentially choosing to ignore if there is an error because
// outputting the image ID is a NTH and not integral to the pull
if err == nil {
fmt.Println(iid)
}
return nil
}