[apparmor] [PATCH 7/8] utils: Add option to aa-easyprof to specify the apparmor_parser path

Christian Boltz apparmor at cboltz.de
Sun Feb 12 19:04:45 UTC 2017


Hello,

Am Mittwoch, 8. Februar 2017, 22:01:44 CET schrieb Tyler Hicks:
> When testing against a clean system without the apparmor_parser binary
> installed, the test-aa-easyprof.py script ends up skipping profile
> verification because it can't find the parser binary. This even
> causes a test failure due to the
> test_genpolicy_invalid_template_policy test.
> 
> Adding a --parser option to aa-easyprof is the first step in
> addressing this problem.

> --- a/utils/apparmor/easyprof.py
> +++ b/utils/apparmor/easyprof.py

> @@ -309,6 +306,14 @@ class AppArmorEasyProfile:
>          if os.path.isfile(self.conffile):
>              self._get_defaults()
> 
> +        self.parser_path = '/sbin/apparmor_parser'
> +        if opt.parser_path:
> +            self.parser_path = opt.parser_path
> +        elif not os.path.exists(self.parser_path):
> +            rc, self.parser_path = cmd(['which', 'apparmor_parser'])
> +            if rc != 0:
> +                self.parser_path = None

I know you only moved code around, but - we have a nice which() function 
in aa.py ;-) which I'd prefer over calling an external command.

With or without this changed,
    Acked-by: Christian Boltz <apparmor at cboltz.de>


Regards,

Christian Boltz
-- 
Hehehe: Der LaTeX Benutzer flucht halt auf den ersten zehn Seiten.
Der Word-Mensch auf den danach folgenden.         -- Karl Wunderle
-------------- 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/20170212/e5aa9ca9/attachment.pgp>


More information about the AppArmor mailing list