pkg/apparmor: fix when AA is disabled
Do not try to load the default profile when AppArmor is disabled on the
host.
Fixes:
@@ -225,9 +225,14 @@ func CheckProfileAndLoadDefault(name string) (string, error) {
}
}
- if name != "" && !runcaa.IsEnabled() {
+ // 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,
// ignore it and return the name.
