drop dead code from tools.py

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.


Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
Christian Boltz 2017-06-26 21:27:06 +02:00
parent b289f0928e
commit 673be01cdc
2 changed files with 3 additions and 16 deletions

View file

@ -33,4 +33,4 @@ args = parser.parse_args()
clean = apparmor.tools.aa_tools('cleanprof', args)
clean.act()
clean.cleanprof_act()

View file

@ -84,7 +84,7 @@ class aa_tools:
yield (program, profile)
def act(self):
def cleanprof_act(self):
# used by aa-cleanprof
apparmor.read_profiles()
@ -100,20 +100,7 @@ class aa_tools:
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: