mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
utils: Use apparmor.fail for AppArmorException handling in aa-easyprof
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@canonical.com> Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
import apparmor.easyprof
|
import apparmor.easyprof
|
||||||
from apparmor.easyprof import AppArmorException, error
|
from apparmor.easyprof import error
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -61,12 +61,7 @@ if __name__ == "__main__":
|
|||||||
for (binary, options) in profiles:
|
for (binary, options) in profiles:
|
||||||
if len(profiles) > 1:
|
if len(profiles) > 1:
|
||||||
count += 1
|
count += 1
|
||||||
try:
|
|
||||||
easyp = apparmor.easyprof.AppArmorEasyProfile(binary, options)
|
easyp = apparmor.easyprof.AppArmorEasyProfile(binary, options)
|
||||||
except AppArmorException as e:
|
|
||||||
error(e.value)
|
|
||||||
except Exception:
|
|
||||||
raise
|
|
||||||
|
|
||||||
if options.list_templates:
|
if options.list_templates:
|
||||||
apparmor.easyprof.print_basefilenames(easyp.get_templates())
|
apparmor.easyprof.print_basefilenames(easyp.get_templates())
|
||||||
@@ -118,7 +113,4 @@ if __name__ == "__main__":
|
|||||||
sys.stdout.write('%s\n' % easyp.gen_manifest(params))
|
sys.stdout.write('%s\n' % easyp.gen_manifest(params))
|
||||||
else:
|
else:
|
||||||
params['no_verify'] = options.no_verify
|
params['no_verify'] = options.no_verify
|
||||||
try:
|
|
||||||
easyp.output_policy(params, count, opt.output_directory)
|
easyp.output_policy(params, count, opt.output_directory)
|
||||||
except AppArmorException as e:
|
|
||||||
error(e)
|
|
||||||
|
Reference in New Issue
Block a user