lib: abstract out selinux call

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-01-22 16:52:31 -05:00
parent 8ea79e755f
commit e53b0a055a
Signed by: vbatts
GPG key ID: 10937E57733F1362
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
@ -287,7 +286,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
}