mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 05:47:59 +00:00
Merge test-aa-show-usage: correctly handle disabled profiles
test_show_unconfined_profiles did not exclude disabled profiles from the expected results, which led to test failures when some profiles were disabled. Disabled profiles are now correctly excluded from the results, fixing the test. Reported-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: Maxime Bélair <maxime.belair@canonical.com> MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1780 Approved-by: Christian Boltz <apparmor@cboltz.de> Merged-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
commit
d72cc8f09e
@ -92,7 +92,16 @@ Filtering options:
|
||||
if line.startswith(' Profile '):
|
||||
nb_profile += 1
|
||||
|
||||
command = ['grep', '-Er', r'flags=.*unconfined.*\{', '--', aa.profile_dir]
|
||||
command = ['grep', '-Er', r'flags=.*unconfined.*\{']
|
||||
|
||||
# Remove disabled profiles from grep
|
||||
disable_dir = os.path.join(aa.profile_dir, 'disable')
|
||||
if os.path.isdir(disable_dir):
|
||||
for name in os.listdir(disable_dir):
|
||||
command.append('--exclude=' + name)
|
||||
|
||||
command.extend(['--', aa.profile_dir])
|
||||
|
||||
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True, check=False)
|
||||
self.assertEqual(
|
||||
len(result.stdout.splitlines()), nb_profile,
|
||||
|
Loading…
x
Reference in New Issue
Block a user