summaryrefslogtreecommitdiff
path: root/libpod/runtime_img.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-03-06 10:42:13 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-07 20:59:11 +0000
commit4344639508ccd16041d1ec7fd531b6427f930374 (patch)
tree4b28256bae65377bdf4f4900461f3f5379869bf1 /libpod/runtime_img.go
parentf57b7bbf43fe7fc7ada8055911c7ac55e53fa698 (diff)
downloadpodman-4344639508ccd16041d1ec7fd531b6427f930374.tar.gz
podman-4344639508ccd16041d1ec7fd531b6427f930374.tar.bz2
podman-4344639508ccd16041d1ec7fd531b6427f930374.zip
podman import, load, and commit are too verbose
The progress should not be show for import, load, and commit. It makes machine parsing of the output much more difficult. Also, each command should output an image ID or name for the user. Added a --verbose flag for users that still want to see progress. Resolves issue #450 Signed-off-by: baude <bbaude@redhat.com> Closes: #456 Approved by: rhatdan
Diffstat (limited to 'libpod/runtime_img.go')
-rw-r--r--libpod/runtime_img.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 8a21785bf..bc328d5b9 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -1032,30 +1032,30 @@ func (r *Runtime) GetHistory(image string) ([]ociv1.History, []types.BlobInfo, s
}
// ImportImage imports an OCI format image archive into storage as an image
-func (r *Runtime) ImportImage(path string, options CopyOptions) error {
+func (r *Runtime) ImportImage(path string, options CopyOptions) (*storage.Image, error) {
r.lock.RLock()
defer r.lock.RUnlock()
if !r.valid {
- return ErrRuntimeStopped
+ return nil, ErrRuntimeStopped
}
file := TarballTransport + ":" + path
src, err := alltransports.ParseImageName(file)
if err != nil {
- return errors.Wrapf(err, "error parsing image name %q", path)
+ return nil, errors.Wrapf(err, "error parsing image name %q", path)
}
updater, ok := src.(tarball.ConfigUpdater)
if !ok {
- return errors.Wrapf(err, "unexpected type, a tarball reference should implement tarball.ConfigUpdater")
+ return nil, errors.Wrapf(err, "unexpected type, a tarball reference should implement tarball.ConfigUpdater")
}
annotations := make(map[string]string)
err = updater.ConfigUpdate(options.ImageConfig, annotations)
if err != nil {
- return errors.Wrapf(err, "error updating image config")
+ return nil, errors.Wrapf(err, "error updating image config")
}
var reference = options.Reference
@@ -1065,24 +1065,26 @@ func (r *Runtime) ImportImage(path string, options CopyOptions) error {
if reference == "" {
reference, err = getImageDigest(src, sc)
if err != nil {
- return err
+ return nil, err
}
}
policyContext, err := getPolicyContext(sc)
if err != nil {
- return err
+ return nil, err
}
defer policyContext.Destroy()
-
- copyOptions := common.GetCopyOptions(os.Stdout, "", nil, nil, common.SigningOptions{}, "", "", false)
+ copyOptions := common.GetCopyOptions(options.Writer, "", nil, nil, common.SigningOptions{}, "", "", false)
dest, err := is.Transport.ParseStoreReference(r.store, reference)
if err != nil {
errors.Wrapf(err, "error getting image reference for %q", options.Reference)
}
-
- return cp.Image(policyContext, dest, src, copyOptions)
+ if err = cp.Image(policyContext, dest, src, copyOptions); err != nil {
+ return nil, err
+ }
+ // Use no lock version of GetImage
+ return r.getImage(reference)
}
// GetImageInspectInfo returns the inspect information of an image