[apparmor] [patch] drop dead code from tools.py
Christian Boltz
apparmor at cboltz.de
Sun Jun 25 08:49:55 UTC 2017
Hello,
tools.py act() is only used by aa-cleanprof, therefore the else branch
(self.name != cleanprof) never gets used.
This patch drops the dead code and renames act() to cleanprof_act() to
make it clear that only aa-cleanprof calls this function.
[ 01-tools-dead-code.diff ]
=== modified file ./utils/aa-cleanprof
--- utils/aa-cleanprof 2016-10-01 21:00:58.949770000 +0200
+++ utils/aa-cleanprof 2017-06-25 10:39:44.811697668 +0200
@@ -33,4 +33,4 @@
clean = apparmor.tools.aa_tools('cleanprof', args)
-clean.act()
+clean.cleanprof_act()
=== modified file ./utils/apparmor/tools.py
--- utils/apparmor/tools.py 2017-06-25 10:39:24.039817320 +0200
+++ utils/apparmor/tools.py 2017-06-25 10:39:33.399763247 +0200
@@ -84,7 +84,7 @@
yield (program, profile)
- def act(self):
+ def cleanprof_act(self):
# used by aa-cleanprof
apparmor.read_profiles()
@@ -100,20 +100,7 @@
sys.exit(1)
if program and apparmor.profile_exists(program):
- if self.name == 'cleanprof':
- self.clean_profile(program)
-
- else:
- filename = apparmor.get_profile_filename(program)
-
- if not os.path.isfile(filename) or apparmor.is_skippable_file(filename):
- aaui.UI_Info(_('Profile for %s not found, skipping') % program)
-
- else:
- # One simply does not walk in here!
- raise apparmor.AppArmorException('Unknown tool: %s' % self.name)
-
- self.reload_profile(profile)
+ self.clean_profile(program)
else:
if '/' not in program:
Regards,
Christian Boltz
--
>> Einmal im Jahr sorgen MS Produkte durch das Internet für
>> Milliardenschäden in der Wirtschaft
> 2000: Love Letter, 2001: Code Red und Nimda, 2003: Sapphire, 2002?
Windows XP. [Eric Wick, Wolfgang Ewert und Urs Traenkner in dcsm]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170625/3e97eb04/attachment-0001.pgp>
More information about the AppArmor
mailing list