crio: abstract the selinux call

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-01-22 16:45:55 -05:00
parent 8ea79e755f
commit 23ff4427e2
Signed by: vbatts
GPG key ID: 10937E57733F1362
3 changed files with 19 additions and 2 deletions

View file

@ -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) {

View file

@ -0,0 +1,9 @@
// +build linux
package main
import selinux "github.com/opencontainers/selinux/go-selinux"
func disableSELinux() {
selinux.SetDisabled()
}

View file

@ -0,0 +1,9 @@
// +build !linux
package main
import "github.com/sirupsen/logrus"
func disableSELinux() {
logrus.Infof("there is no selinux to disable")
}