summaryrefslogtreecommitdiff
path: root/libpod/container_api.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/container_api.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/container_api.go')
-rw-r--r--libpod/container_api.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 38c3faeef..253428256 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -9,6 +9,7 @@ import (
"strconv"
"time"
+ "github.com/containers/storage"
"github.com/docker/docker/daemon/caps"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/stringid"
@@ -588,19 +589,19 @@ func (c *Container) Inspect(size bool) (*inspect.ContainerInspectData, error) {
// Commit commits the changes between a container and its image, creating a new
// image
-func (c *Container) Commit(pause bool, options CopyOptions) error {
+func (c *Container) Commit(pause bool, options CopyOptions) (*storage.Image, error) {
if !c.locked {
c.lock.Lock()
defer c.lock.Unlock()
if err := c.syncContainer(); err != nil {
- return err
+ return nil, err
}
}
if c.state.State == ContainerStateRunning && pause {
if err := c.runtime.ociRuntime.pauseContainer(c); err != nil {
- return errors.Wrapf(err, "error pausing container %q", c.ID())
+ return nil, errors.Wrapf(err, "error pausing container %q", c.ID())
}
defer func() {
if err := c.runtime.ociRuntime.unpauseContainer(c); err != nil {
@@ -611,13 +612,13 @@ func (c *Container) Commit(pause bool, options CopyOptions) error {
tempFile, err := ioutil.TempFile(c.runtime.config.TmpDir, "podman-commit")
if err != nil {
- return errors.Wrapf(err, "error creating temp file")
+ return nil, errors.Wrapf(err, "error creating temp file")
}
defer os.Remove(tempFile.Name())
defer tempFile.Close()
if err := c.export(tempFile.Name()); err != nil {
- return err
+ return nil, err
}
return c.runtime.ImportImage(tempFile.Name(), options)
}