[apparmor] [PATCH] utils: Use apparmor.fail for AppArmorException handling in aa-easyprof

Christian Boltz apparmor at cboltz.de
Wed Dec 16 11:12:45 UTC 2015


Hello,

Am Dienstag, 15. Dezember 2015 schrieb Tyler Hicks:
> Don't catch AppArmorExceptions in aa-easyprof any longer and rely on
> apparmor.fail to print the exception to stderr.
> 
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>

This change will also make importing AppArmorException superfluous
(which means make -C utils check will complain about it ;-)

Therefore please also do

-from apparmor.easyprof import AppArmorException, error
+from apparmor.easyprof import error

With AppArmorException removed from the import statement,
    Acked-by: Christian Boltz <apparmor at cboltz.de> for trunk and 2.10


(Actually you want to import error() from apparmor.common and delete 
error() from apparmor.easyprof, but that's worth another cleanup patch.)

> ---
>  utils/aa-easyprof | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/utils/aa-easyprof b/utils/aa-easyprof
> index 93861ae..de7236c 100755
> --- a/utils/aa-easyprof
> +++ b/utils/aa-easyprof
> @@ -61,12 +61,7 @@ if __name__ == "__main__":
>      for (binary, options) in profiles:
>          if len(profiles) > 1:
>              count += 1
> -        try:
> -            easyp = apparmor.easyprof.AppArmorEasyProfile(binary,
> options) -        except AppArmorException as e:
> -            error(e.value)
> -        except Exception:
> -            raise
> +        easyp = apparmor.easyprof.AppArmorEasyProfile(binary,
> options)
> 
>          if options.list_templates:
>             
> apparmor.easyprof.print_basefilenames(easyp.get_templates()) @@
> -118,7 +113,4 @@ if __name__ == "__main__":
>              sys.stdout.write('%s\n' % easyp.gen_manifest(params))
>          else:
>              params['no_verify'] = options.no_verify
> -            try:
> -                easyp.output_policy(params, count,
> opt.output_directory) -            except AppArmorException as e:
> -                error(e)
> +            easyp.output_policy(params, count, opt.output_directory)


Regards,

Christian Boltz
-- 
Danke an alle, die mir bei der Geburt geholfen haben, das Baby brennt ;)
[CD-Brenner-Einrichtung  - Thorsten von Plotho-Kettner in suse-linux]




More information about the AppArmor mailing list