summaryrefslogtreecommitdiff
path: root/cmd/podman/pod_stats.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-12 16:53:46 +0200
committerGitHub <noreply@github.com>2019-08-12 16:53:46 +0200
commitec93c9d8753c1cf346fe7fee3035af1a0dcf9b55 (patch)
tree37a407bad913399b31b543db9caa7dbb5e13a232 /cmd/podman/pod_stats.go
parentf18cfa47686a30166cfe6f743dbda0e13575e4f2 (diff)
parent9e2f9c8b7804cec7ed7bcf595272de976f799ef6 (diff)
downloadpodman-ec93c9d8753c1cf346fe7fee3035af1a0dcf9b55.tar.gz
podman-ec93c9d8753c1cf346fe7fee3035af1a0dcf9b55.tar.bz2
podman-ec93c9d8753c1cf346fe7fee3035af1a0dcf9b55.zip
Merge pull request #3786 from giuseppe/fix-rootless-checks
rootless: drop some superflous checks
Diffstat (limited to 'cmd/podman/pod_stats.go')
-rw-r--r--cmd/podman/pod_stats.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/podman/pod_stats.go b/cmd/podman/pod_stats.go
index 46cacc026..2f1ebd3ac 100644
--- a/cmd/podman/pod_stats.go
+++ b/cmd/podman/pod_stats.go
@@ -15,6 +15,8 @@ import (
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
+ "github.com/containers/libpod/pkg/cgroups"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -53,9 +55,14 @@ func init() {
}
func podStatsCmd(c *cliconfig.PodStatsValues) error {
-
- if os.Geteuid() != 0 {
- return errors.New("stats is not supported in rootless mode")
+ if rootless.IsRootless() {
+ unified, err := cgroups.IsCgroup2UnifiedMode()
+ if err != nil {
+ return err
+ }
+ if !unified {
+ return errors.New("stats is not supported in rootless mode without cgroups v2")
+ }
}
format := c.Format