mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-04 00:05:14 +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:
@@ -1,6 +1,6 @@
|
|||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# Copyright (C) 2013 Kshitij Gupta <kgupta8592@gmail.com>
|
# 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
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of version 2 of the GNU General Public
|
# 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):
|
def __init__(self, tool_name, args):
|
||||||
apparmor.init_aa(profiledir=args.dir, confdir=args.configdir)
|
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.name = tool_name
|
||||||
self.profiling = args.program
|
self.profiling = args.program
|
||||||
self.check_profile_dir()
|
|
||||||
self.silent = None
|
self.silent = None
|
||||||
self.do_reload = args.do_reload
|
self.do_reload = args.do_reload
|
||||||
|
|
||||||
@@ -41,10 +43,6 @@ class aa_tools:
|
|||||||
elif tool_name == 'cleanprof':
|
elif tool_name == 'cleanprof':
|
||||||
self.silent = args.silent
|
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):
|
def get_next_to_profile(self):
|
||||||
'''Iterator function to walk the list of arguments passed'''
|
'''Iterator function to walk the list of arguments passed'''
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user