[apparmor] [patch] cleanup aa-disable handling in tools.py
Christian Boltz
apparmor at cboltz.de
Fri Feb 27 14:21:43 UTC 2015
Hello,
to keep the number of pending patches stable:
This patch cleans up the aa-disable handling in tools.py.
Initially, I wanted to move the aa-disable specific code from __init__()
and the two lines in check_disable_dir() to cmd_disable().
Then I followed the code a bit and found out that create_symlink() in
aa.py (called in disable_profile()) creates the directory if it doesn't
exist.
Long story short: The patch removes the check if the disable directory
exists. If it's really missing, it will be auto-created by
create_symlink(), so we automagically fix things instead of annoying the
user with an error message ;-)
I propose this for trunk and 2.9, but trunk only would also be ok.
[ tools-cleanup-disable.diff ]
=== modified file 'utils/apparmor/tools.py'
--- utils/apparmor/tools.py 2015-02-27 13:19:00 +0000
+++ utils/apparmor/tools.py 2015-02-27 14:14:20 +0000
@@ -32,9 +32,6 @@
if tool_name in ['audit']:
self.remove = args.remove
- elif tool_name == 'disable':
- self.disabledir = apparmor.profile_dir + '/disable'
- self.check_disable_dir()
elif tool_name == 'autodep':
self.force = args.force
self.aa_mountpoint = apparmor.check_for_apparmor()
@@ -50,10 +47,6 @@
if not user_perm(apparmor.profile_dir):
raise apparmor.AppArmorException("Cannot write to profile directory: %s" % (apparmor.profile_dir))
- def check_disable_dir(self):
- if not os.path.isdir(self.disabledir):
- raise apparmor.AppArmorException("Can't find AppArmor disable directory %s" % self.disabledir)
-
def get_next_to_profile(self):
'''Iterator function to walk the list of arguments passed'''
Regards,
Christian Boltz
--
Zu meiner Entschuldigung: Ich konnte es nicht nochmal durchlesen,
weil meine Kippenschachtel leer war und ich also schnell das Haus
verlassen musste. Das neue Jahr - keine 11 Tage alt und die (guten)
Vorsätze schon alle über Bord.... [Rüdiger Meier in suse-linux]
More information about the AppArmor
mailing list