2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 13:58:22 +00:00

De-duplicate code in read_profile()

This commit is contained in:
Christian Boltz
2024-10-06 21:49:28 +02:00
parent 578ab8da9d
commit 2e8a75195c

View File

@@ -1685,23 +1685,16 @@ def read_profile(file, active_profile, read_error_fatal=False):
attach_profile_data(aa, profile_data) attach_profile_data(aa, profile_data)
attach_profile_data(original_aa, profile_data) attach_profile_data(original_aa, profile_data)
for profile in profile_data: for profile in profile_data:
attachment = profile_data[profile]['attachment'] attachment = profile_data[profile]['attachment']
filename = profile_data[profile]['filename'] filename = profile_data[profile]['filename']
if not attachment and profile.startswith('/'): if not attachment and profile.startswith('/'):
attachment = profile # use profile as name and attachment attachment = profile # use profile as name and attachment
if active_profile:
active_profiles.add_profile(filename, profile, attachment, profile_data[profile]) active_profiles.add_profile(filename, profile, attachment, profile_data[profile])
else:
else:
for profile in profile_data:
attachment = profile_data[profile]['attachment']
filename = profile_data[profile]['filename']
if not attachment and profile.startswith('/'):
attachment = profile # use profile as name and attachment
extra_profiles.add_profile(filename, profile, attachment, profile_data[profile]) extra_profiles.add_profile(filename, profile, attachment, profile_data[profile])