pkg/apparmor: fix when AA is disabled

Do not try to load the default profile when AppArmor is disabled on the
host.

Fixes: #3331
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2019-06-14 17:33:47 +02:00
parent 1322b41aa0
commit e611176760

View File

@ -225,8 +225,13 @@ func CheckProfileAndLoadDefault(name string) (string, error) {
}
}
if name != "" && !runcaa.IsEnabled() {
return "", fmt.Errorf("profile %q specified but AppArmor is disabled on the host", name)
// Check if AppArmor is disabled and error out if a profile is to be set.
if !runcaa.IsEnabled() {
if name == "" {
return "", nil
} else {
return "", fmt.Errorf("profile %q specified but AppArmor is disabled on the host", name)
}
}
// If the specified name is not empty or is not a default libpod one,