Merge pull request #1382 from vbatts/platform-001

crio: abstract the selinux call
This commit is contained in:
Daniel J Walsh 2018-02-28 14:05:05 -08:00 committed by GitHub
commit bb9a5aadd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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/lib"
"github.com/kubernetes-incubator/cri-o/server" "github.com/kubernetes-incubator/cri-o/server"
"github.com/kubernetes-incubator/cri-o/version" "github.com/kubernetes-incubator/cri-o/version"
"github.com/opencontainers/selinux/go-selinux"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/soheilhy/cmux" "github.com/soheilhy/cmux"
"github.com/urfave/cli" "github.com/urfave/cli"
@ -429,7 +428,7 @@ func main() {
config := c.App.Metadata["config"].(*server.Config) config := c.App.Metadata["config"].(*server.Config)
if !config.SELinux { if !config.SELinux {
selinux.SetDisabled() disableSELinux()
} }
if _, err := os.Stat(config.Runtime); os.IsNotExist(err) { 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")
}