[apparmor] [patch] drop dead code from tools.py
Seth Arnold
seth.arnold at canonical.com
Mon Jun 26 19:04:39 UTC 2017
On Sun, Jun 25, 2017 at 10:49:55AM +0200, Christian Boltz wrote:
> 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 ]
Acked-by: Seth Arnold <seth.arnold at canonical.com>
Acked for trunk
Thanks
>
> === 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:
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170626/370ac9f8/attachment.pgp>
More information about the AppArmor
mailing list