Merge pull request #1382 from vbatts/platform-001
crio: abstract the selinux call
This commit is contained in:
commit
bb9a5aadd8
3 changed files with 19 additions and 2 deletions
|
@ -17,7 +17,6 @@ import (
|
|||
"github.com/kubernetes-incubator/cri-o/lib"
|
||||
"github.com/kubernetes-incubator/cri-o/server"
|
||||
"github.com/kubernetes-incubator/cri-o/version"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/soheilhy/cmux"
|
||||
"github.com/urfave/cli"
|
||||
|
@ -429,7 +428,7 @@ func main() {
|
|||
config := c.App.Metadata["config"].(*server.Config)
|
||||
|
||||
if !config.SELinux {
|
||||
selinux.SetDisabled()
|
||||
disableSELinux()
|
||||
}
|
||||
|
||||
if _, err := os.Stat(config.Runtime); os.IsNotExist(err) {
|
||||
|
|
9
cmd/crio/selinux_linux.go
Normal file
9
cmd/crio/selinux_linux.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
// +build linux
|
||||
|
||||
package main
|
||||
|
||||
import selinux "github.com/opencontainers/selinux/go-selinux"
|
||||
|
||||
func disableSELinux() {
|
||||
selinux.SetDisabled()
|
||||
}
|
9
cmd/crio/selinux_unsupported.go
Normal file
9
cmd/crio/selinux_unsupported.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
// +build !linux
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/sirupsen/logrus"
|
||||
|
||||
func disableSELinux() {
|
||||
logrus.Infof("there is no selinux to disable")
|
||||
}
|
Loading…
Reference in a new issue