mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
split off get_new_profile_filename()
... and call it from get_profile_filename_* if get_new is True (= always with the current code)
This commit is contained in:
@@ -219,17 +219,32 @@ def find_executable(bin_path):
|
|||||||
|
|
||||||
def get_profile_filename_from_profile_name(profile, get_new=False):
|
def get_profile_filename_from_profile_name(profile, get_new=False):
|
||||||
"""Returns the full profile name for the given profile name"""
|
"""Returns the full profile name for the given profile name"""
|
||||||
return get_profile_filename_orig(profile)
|
|
||||||
|
filename = get_profile_filename_orig(profile)
|
||||||
|
if filename:
|
||||||
|
return filename
|
||||||
|
|
||||||
|
if get_new:
|
||||||
|
return get_new_profile_filename(profile)
|
||||||
|
|
||||||
def get_profile_filename_from_attachment(profile, get_new=False):
|
def get_profile_filename_from_attachment(profile, get_new=False):
|
||||||
"""Returns the full profile name for the given attachment"""
|
"""Returns the full profile name for the given attachment"""
|
||||||
return get_profile_filename_orig(profile)
|
|
||||||
|
filename = get_profile_filename_orig(profile)
|
||||||
|
if filename:
|
||||||
|
return filename
|
||||||
|
|
||||||
|
if get_new:
|
||||||
|
return get_new_profile_filename(profile)
|
||||||
|
|
||||||
def get_profile_filename_orig(profile):
|
def get_profile_filename_orig(profile):
|
||||||
"""Returns the full profile name"""
|
"""Returns the full profile name"""
|
||||||
if existing_profiles.get(profile, False):
|
if existing_profiles.get(profile, False):
|
||||||
return existing_profiles[profile]
|
return existing_profiles[profile]
|
||||||
elif profile.startswith('/'):
|
|
||||||
|
def get_new_profile_filename(profile):
|
||||||
|
'''Compose filename for a new profile'''
|
||||||
|
if profile.startswith('/'):
|
||||||
# Remove leading /
|
# Remove leading /
|
||||||
profile = profile[1:]
|
profile = profile[1:]
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user