summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorAshley Cui <ashleycui16@gmail.com>2019-07-02 14:26:11 -0400
committerAshley Cui <ashleycui16@gmail.com>2019-07-02 14:33:03 -0400
commita704be59e51d301c3419af53bb57c139766bcae2 (patch)
tree3b9f82cd4665a3ea116ed2f210247588f0072885 /cmd/podman
parent26d02e97395b2fb5ab5abdc0a35ab6019dccbe18 (diff)
downloadpodman-a704be59e51d301c3419af53bb57c139766bcae2.tar.gz
podman-a704be59e51d301c3419af53bb57c139766bcae2.tar.bz2
podman-a704be59e51d301c3419af53bb57c139766bcae2.zip
Fix rootless detection error for pause & unpause
Previously, when pause & unpause were run on rootless, the error message that pause was unsupported for rootless was not being thrown. When running remote, even if remote host was root, unsupported rootless error was being thrown. Now, the error shows up when appropriate. Signed-off-by: Ashley Cui <ashleycui16@gmail.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/pause.go5
-rw-r--r--cmd/podman/unpause.go5
2 files changed, 4 insertions, 6 deletions
diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go
index 4bef20867..ee5fd352d 100644
--- a/cmd/podman/pause.go
+++ b/cmd/podman/pause.go
@@ -1,11 +1,10 @@
package main
import (
- "os"
-
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -39,7 +38,7 @@ func init() {
}
func pauseCmd(c *cliconfig.PauseValues) error {
- if os.Geteuid() != 0 {
+ if rootless.IsRootless() && !remoteclient {
return errors.New("pause is not supported for rootless containers")
}
diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go
index 55bfe584e..8126ebfbd 100644
--- a/cmd/podman/unpause.go
+++ b/cmd/podman/unpause.go
@@ -1,11 +1,10 @@
package main
import (
- "os"
-
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -38,7 +37,7 @@ func init() {
}
func unpauseCmd(c *cliconfig.UnpauseValues) error {
- if os.Geteuid() != 0 {
+ if rootless.IsRootless() && !remoteclient {
return errors.New("unpause is not supported for rootless containers")
}