[apparmor] [patch] Fix raising AppArmorException in aa-mergeprof

Christian Boltz apparmor at cboltz.de
Sun May 17 15:22:07 UTC 2015


Hello,

aa-mergeprof failed to fail ;-) when it should raise an AppArmorException.
Instead, it failed with

    AttributeError: 'module' object has no attribute 'AppArmorException'


I confirmed this bug in trunk and 2.9, therefore I propose this patch
for both.


[ 07-mergeprof-exceptions.diff ]

=== modified file 'utils/aa-mergeprof'
--- utils/aa-mergeprof  2014-10-16 21:35:06 +0000
+++ utils/aa-mergeprof  2015-05-17 15:12:35 +0000
@@ -18,6 +18,7 @@
 
 import apparmor.aa
 import apparmor.aamode
+from apparmor.common import AppArmorException
 import apparmor.severity
 import apparmor.cleanprofile as cleanprofile
 import apparmor.ui as aaui
@@ -43,7 +44,7 @@
 if profiledir:
     apparmor.aa.profile_dir = apparmor.aa.get_full_path(profiledir)
     if not os.path.isdir(apparmor.aa.profile_dir):
-        raise apparmor.AppArmorException(_("%s is not a directory.") %profiledir)
+        raise AppArmorException(_("%s is not a directory.") %profiledir)
 
 def reset_aa():
     apparmor.aa.aa = apparmor.aa.hasher()
@@ -229,7 +230,7 @@
                             return o
                             pass#self.user.aa[profile][hat][allow][path][mode] = (old_mode | new_mode) - (new_mode & conflict_x)
                         else:
-                            raise apparmor.aa.AppArmorException(_('Unknown selection'))
+                            raise AppArmorException(_('Unknown selection'))
                         done = True
 
     def ask_the_questions(self, other, profile):


Regards,

Christian Boltz
-- 
> [perl -pi -e] Das erspart es einem, selber die Dateien zu kopieren:
sed hat inzwischen auch einen -i Parameter. Willkommen in 2005, David ;)
[> David Haller und Peter Wiersig in suse-linux]




More information about the AppArmor mailing list