mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Change apparmor.common.combine_profname arguments from list to tuple literals.
This commit is contained in:
parent
179ac34113
commit
084e35e3be
@ -480,7 +480,7 @@ def create_new_profile(localfile, is_stub=False):
|
|||||||
for hatglob in cfg['required_hats'].keys():
|
for hatglob in cfg['required_hats'].keys():
|
||||||
if re.search(hatglob, localfile):
|
if re.search(hatglob, localfile):
|
||||||
for hat in sorted(cfg['required_hats'][hatglob].split()):
|
for hat in sorted(cfg['required_hats'][hatglob].split()):
|
||||||
full_hat = combine_profname([localfile, hat])
|
full_hat = combine_profname((localfile, hat))
|
||||||
if not local_profile.get(full_hat, False):
|
if not local_profile.get(full_hat, False):
|
||||||
local_profile[full_hat] = ProfileStorage('NEW', hat, 'create_new_profile() required_hats')
|
local_profile[full_hat] = ProfileStorage('NEW', hat, 'create_new_profile() required_hats')
|
||||||
local_profile[full_hat]['is_hat'] = True
|
local_profile[full_hat]['is_hat'] = True
|
||||||
@ -1855,7 +1855,7 @@ def parse_profile_data(data, file, do_include, in_preamble):
|
|||||||
if do_include:
|
if do_include:
|
||||||
profile = file
|
profile = file
|
||||||
hat = None
|
hat = None
|
||||||
profname = combine_profname([profile, hat])
|
profname = combine_profname((profile, hat))
|
||||||
profile_data[profname] = ProfileStorage(profile, hat, 'parse_profile_data() do_include')
|
profile_data[profname] = ProfileStorage(profile, hat, 'parse_profile_data() do_include')
|
||||||
profile_data[profname]['filename'] = file
|
profile_data[profname]['filename'] = file
|
||||||
|
|
||||||
@ -1899,7 +1899,7 @@ def parse_profile_data(data, file, do_include, in_preamble):
|
|||||||
|
|
||||||
if profile == hat:
|
if profile == hat:
|
||||||
hat = None
|
hat = None
|
||||||
profname = combine_profname([profile, hat])
|
profname = combine_profname((profile, hat))
|
||||||
|
|
||||||
if profile_data.get(profname, False):
|
if profile_data.get(profname, False):
|
||||||
raise AppArmorException(
|
raise AppArmorException(
|
||||||
@ -1924,7 +1924,7 @@ def parse_profile_data(data, file, do_include, in_preamble):
|
|||||||
if in_contained_hat:
|
if in_contained_hat:
|
||||||
hat = None
|
hat = None
|
||||||
in_contained_hat = False
|
in_contained_hat = False
|
||||||
profname = combine_profname([profile, hat])
|
profname = combine_profname((profile, hat))
|
||||||
else:
|
else:
|
||||||
parsed_profiles.append(profile)
|
parsed_profiles.append(profile)
|
||||||
profile = None
|
profile = None
|
||||||
@ -2065,7 +2065,7 @@ def parse_profile_data(data, file, do_include, in_preamble):
|
|||||||
for parsed_prof in sorted(parsed_profiles):
|
for parsed_prof in sorted(parsed_profiles):
|
||||||
if re.search(hatglob, parsed_prof):
|
if re.search(hatglob, parsed_prof):
|
||||||
for hat in cfg['required_hats'][hatglob].split():
|
for hat in cfg['required_hats'][hatglob].split():
|
||||||
profname = combine_profname([parsed_prof, hat])
|
profname = combine_profname((parsed_prof, hat))
|
||||||
if not profile_data.get(profname, False):
|
if not profile_data.get(profname, False):
|
||||||
profile_data[profname] = ProfileStorage(parsed_prof, hat, 'parse_profile_data() required_hats')
|
profile_data[profname] = ProfileStorage(parsed_prof, hat, 'parse_profile_data() required_hats')
|
||||||
profile_data[profname]['is_hat'] = True
|
profile_data[profname]['is_hat'] = True
|
||||||
@ -2140,7 +2140,7 @@ def split_to_merged(profile_data):
|
|||||||
if profile == hat:
|
if profile == hat:
|
||||||
merged_name = profile
|
merged_name = profile
|
||||||
else:
|
else:
|
||||||
merged_name = combine_profname([profile, hat])
|
merged_name = combine_profname((profile, hat))
|
||||||
|
|
||||||
merged[merged_name] = profile_data[profile][hat]
|
merged[merged_name] = profile_data[profile][hat]
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ class AaTest_split_name(AATest):
|
|||||||
class AaTest_combine_profname(AATest):
|
class AaTest_combine_profname(AATest):
|
||||||
tests = (
|
tests = (
|
||||||
# name parts expected full profile name
|
# name parts expected full profile name
|
||||||
(['foo'], 'foo'),
|
(('foo',), 'foo'),
|
||||||
(['foo', 'bar'], 'foo//bar'),
|
(('foo', 'bar'), 'foo//bar'),
|
||||||
(['foo', 'bar', 'baz'], 'foo//bar//baz'),
|
(('foo', 'bar', 'baz'), 'foo//bar//baz'),
|
||||||
(['foo', 'bar', None], 'foo//bar'),
|
(('foo', 'bar', None), 'foo//bar'),
|
||||||
(['foo', 'bar', 'baz', None], 'foo//bar//baz'),
|
(('foo', 'bar', 'baz', None), 'foo//bar//baz'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def _run_test(self, params, expected):
|
def _run_test(self, params, expected):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user