Merge pull request #212 from miaoyq/related-selinux

Add build tags and Improve the test case of selinux
This commit is contained in:
Lantao Liu
2017-09-21 21:07:53 -07:00
committed by GitHub
3 changed files with 23 additions and 13 deletions

View File

@@ -376,11 +376,19 @@ func initSelinuxOpts(selinuxOpt *runtime.SELinuxOption) (string, string, error)
return "", "", nil
}
// Should ignored selinuxOpts if they are incomplete.
if selinuxOpt.GetUser() == "" ||
selinuxOpt.GetRole() == "" ||
selinuxOpt.GetType() == "" ||
selinuxOpt.GetLevel() == "" {
return "", "", nil
}
labelOpts := fmt.Sprintf("%s:%s:%s:%s",
selinuxOpt.GetUser(),
selinuxOpt.GetRole(),
selinuxOpt.GetRole(),
selinuxOpt.GetType())
selinuxOpt.GetType(),
selinuxOpt.GetLevel())
return label.InitLabels(selinux.DupSecOpt(labelOpts))
}