mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-14 13:29:31 +00:00
rootless: RunningInUserNS() is now part of userns namespace
Previously part of the "system" namespace, the RunningInUserNS() has been moved to the "userns" namespace. Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
@@ -30,7 +30,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/containernetworking/plugins/pkg/ns"
|
||||
"github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/opencontainers/runc/libcontainer/userns"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
@@ -78,7 +78,7 @@ func isRootlessFunc() bool {
|
||||
if os.Geteuid() != 0 {
|
||||
return true
|
||||
}
|
||||
if system.RunningInUserNS() {
|
||||
if userns.RunningInUserNS() {
|
||||
return true
|
||||
}
|
||||
SetRootless(false)
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/opencontainers/runc/libcontainer/userns"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestIsRootless(t *testing.T) {
|
||||
if os.Getuid() != 0 {
|
||||
rootless = true
|
||||
} else {
|
||||
rootless = system.RunningInUserNS()
|
||||
rootless = userns.RunningInUserNS()
|
||||
}
|
||||
|
||||
assert.Equal(rootless, isRootlessFunc())
|
||||
|
Reference in New Issue
Block a user