From 673be01cdcd486a6bc6194968fd1acabfc578307 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 26 Jun 2017 21:27:06 +0200 Subject: [PATCH] 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 --- utils/aa-cleanprof | 2 +- utils/apparmor/tools.py | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/utils/aa-cleanprof b/utils/aa-cleanprof index 84f9462b8..acc617380 100755 --- a/utils/aa-cleanprof +++ b/utils/aa-cleanprof @@ -33,4 +33,4 @@ args = parser.parse_args() clean = apparmor.tools.aa_tools('cleanprof', args) -clean.act() +clean.cleanprof_act() diff --git a/utils/apparmor/tools.py b/utils/apparmor/tools.py index 6f3ba3365..a05c54ac1 100644 --- a/utils/apparmor/tools.py +++ b/utils/apparmor/tools.py @@ -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: