summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-23 07:27:19 -0700
committerGitHub <noreply@github.com>2018-10-23 07:27:19 -0700
commitab2b3d64ceaf496107c734575581460185c97369 (patch)
tree679df8924249e4b024886d80c4ab25e412b85825 /cmd/podman
parent9a6a64f78ca3837a0e02373b2ae7f3769fbde568 (diff)
parent6362158615e9bc985efcc2af6d5119df3d073f64 (diff)
downloadpodman-ab2b3d64ceaf496107c734575581460185c97369.tar.gz
podman-ab2b3d64ceaf496107c734575581460185c97369.tar.bz2
podman-ab2b3d64ceaf496107c734575581460185c97369.zip
Merge pull request #1697 from baude/statserr
correct stats err with non-running containers
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/stats.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go
index dea351e88..f6beac1a8 100644
--- a/cmd/podman/stats.go
+++ b/cmd/podman/stats.go
@@ -84,8 +84,7 @@ func statsCmd(c *cli.Context) error {
if ctr > 1 {
return errors.Errorf("--all, --latest and containers cannot be used together")
} else if ctr == 0 {
- // If user didn't specify, imply --all
- all = true
+ return errors.Errorf("you must specify --all, --latest, or at least one container")
}
runtime, err := libpodruntime.GetRuntime(c)
@@ -126,6 +125,10 @@ func statsCmd(c *cli.Context) error {
for _, ctr := range ctrs {
initialStats, err := ctr.GetContainerStats(&libpod.ContainerStats{})
if err != nil {
+ // when doing "all", dont worry about containers that are not running
+ if c.Bool("all") && errors.Cause(err) == libpod.ErrCtrRemoved || errors.Cause(err) == libpod.ErrNoSuchCtr || errors.Cause(err) == libpod.ErrCtrStateInvalid {
+ continue
+ }
return err
}
containerStats[ctr.ID()] = initialStats