Do not retrieve the labels if SELinux is disabled
On the nodes which do not run SELinux this will lead to errors during VM
creation.
@@ -42,6 +42,13 @@ type ContextExecutor struct {
}
func NewContextExecutor(pid int, cmd *exec.Cmd) (*ContextExecutor, error) {
+ if !isSELinuxEnabled() {
+ return &ContextExecutor{
+ pid: pid,
+ cmdToExecute: cmd,
+ }, nil
+ }
+
desiredLabel, err := getLabelForPID(pid)
if err != nil {
return nil, err
