2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

Merge tools.py: inline check_profile_dir() into __init__()

... which was the only caller of this tiny function.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/874
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
Christian Boltz
2022-04-18 11:47:22 +00:00

View File

@@ -1,6 +1,6 @@
# ----------------------------------------------------------------------
# Copyright (C) 2013 Kshitij Gupta <kgupta8592@gmail.com>
# Copyright (C) 2015-2018 Christian Boltz <apparmor@cboltz.de>
# Copyright (C) 2015-2022 Christian Boltz <apparmor@cboltz.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -27,9 +27,11 @@ class aa_tools:
def __init__(self, tool_name, args):
apparmor.init_aa(profiledir=args.dir, confdir=args.configdir)
if not user_perm(apparmor.profile_dir):
raise AppArmorException("Cannot write to profile directory: %s" % (apparmor.profile_dir))
self.name = tool_name
self.profiling = args.program
self.check_profile_dir()
self.silent = None
self.do_reload = args.do_reload
@@ -41,10 +43,6 @@ class aa_tools:
elif tool_name == 'cleanprof':
self.silent = args.silent
def check_profile_dir(self):
if not user_perm(apparmor.profile_dir):
raise AppArmorException("Cannot write to profile directory: %s" % (apparmor.profile_dir))
def get_next_to_profile(self):
'''Iterator function to walk the list of arguments passed'''