Merge pull request #1383 from vbatts/platform-002

lib: abstract out selinux call
This commit is contained in:
Daniel J Walsh 2018-03-04 10:55:07 -05:00 committed by GitHub
commit b212244889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -6,7 +6,6 @@ import (
"github.com/BurntSushi/toml"
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/opencontainers/selinux/go-selinux"
)
// Default paths if none are specified
@ -284,7 +283,7 @@ func DefaultConfig() *Config {
ConmonEnv: []string{
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
},
SELinux: selinux.GetEnabled(),
SELinux: selinuxEnabled(),
SeccompProfile: seccompProfilePath,
ApparmorProfile: apparmorProfileName,
CgroupManager: cgroupManager,

9
lib/config_linux.go Normal file
View file

@ -0,0 +1,9 @@
// +build linux
package lib
import selinux "github.com/opencontainers/selinux/go-selinux"
func selinuxEnabled() bool {
return selinux.GetEnabled()
}

View file

@ -0,0 +1,7 @@
// +build !linux
package lib
func selinuxEnabled() bool {
return false
}