[apparmor] [PATCH v2 1/8] utils: Improve error messages when profiles/parser is not found

Tyler Hicks tyhicks at canonical.com
Wed Mar 1 20:51:59 UTC 2017


When aa.py is imported, it looks for a set of profiles and it also looks
for the parser. Both of these paths are configured by logprof.conf but
it isn't always obvious which logprof.conf file was used and, therefore,
it isn't always obvious where aa.py is looking. This patch includes the
paths in the error messages.

Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
Acked-by: Christian Boltz <apparmor at cboltz.de>
Acked-by: Seth Arnold <seth.arnold at canonical.com>
---
 utils/apparmor/aa.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py
index ab7f6c9..eecf8c7 100644
--- a/utils/apparmor/aa.py
+++ b/utils/apparmor/aa.py
@@ -3754,11 +3754,11 @@ if cfg['settings'].get('default_owner_prompt', False):
 
 profile_dir = conf.find_first_dir(cfg['settings'].get('profiledir')) or '/etc/apparmor.d'
 if not os.path.isdir(profile_dir):
-    raise AppArmorException('Can\'t find AppArmor profiles')
+    raise AppArmorException('Can\'t find AppArmor profiles in %s' % (profile_dir))
 
 extra_profile_dir = conf.find_first_dir(cfg['settings'].get('inactive_profiledir')) or '/usr/share/apparmor/extra-profiles/'
 
 parser = conf.find_first_file(cfg['settings'].get('parser')) or '/sbin/apparmor_parser'
 if not os.path.isfile(parser) or not os.access(parser, os.EX_OK):
-    raise AppArmorException('Can\'t find apparmor_parser')
+    raise AppArmorException('Can\'t find apparmor_parser at %s' % (parser))
 
-- 
2.7.4




More information about the AppArmor mailing list