mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
Simplify apparmor.common.combine_profname
This commit is contained in:
@@ -277,12 +277,12 @@ def split_name(full_profile):
|
|||||||
def combine_profname(name_parts):
|
def combine_profname(name_parts):
|
||||||
"""combine name_parts (main profile, child) into a joint main//child profile name"""
|
"""combine name_parts (main profile, child) into a joint main//child profile name"""
|
||||||
|
|
||||||
if not isinstance(name_parts, list):
|
if not isinstance(name_parts, (list, tuple)):
|
||||||
raise AppArmorBug('combine_profname() called with parameter of type %s, must be a list' % type(name_parts))
|
raise AppArmorBug('combine_profname() called with parameter of type %s, must be a list or tuple' % type(name_parts))
|
||||||
|
|
||||||
# if last item is None, drop it (can happen when called with [profile, hat] when hat is None)
|
# if last item is None, drop it (can happen when called with [profile, hat] when hat is None)
|
||||||
if name_parts[len(name_parts)-1] is None:
|
if name_parts[-1] is None:
|
||||||
name_parts.pop(-1)
|
name_parts = name_parts[:-1]
|
||||||
|
|
||||||
return '//'.join(name_parts)
|
return '//'.join(name_parts)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user