2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 05:47:59 +00:00

Merge Convert original_aa from hasher to dict

This requires adding some `.get()` guards at one place, but should
otherwise be a boring change.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1347
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
John Johansen 2024-10-03 18:36:29 +00:00
commit b52c9bb860

View File

@ -79,7 +79,7 @@ user_globs = {}
transitions = {}
aa = {} # Profiles originally in sd, replace by aa
original_aa = hasher()
original_aa = {}
changed = dict()
created = []
@ -97,7 +97,7 @@ def reset_aa():
aa = {}
include = dict()
active_profiles = ProfileList()
original_aa = hasher()
original_aa = {}
def on_exit():
@ -1625,7 +1625,7 @@ def read_profiles(ui_msg=False, skip_profiles=()):
global aa, original_aa
aa = {}
original_aa = hasher()
original_aa = {}
if ui_msg:
aaui.UI_Info(_('Updating AppArmor profiles in %s.') % profile_dir)
@ -2055,7 +2055,7 @@ def serialize_profile(profile_data, name, options):
# Here should be all the profiles from the files added write after global/common stuff
for prof in sorted(active_profiles.profiles_in_file(prof_filename)):
if prof != name:
if original_aa[prof][prof].get('initial_comment', False):
if original_aa.get(prof, {}).get(prof, {}).get('initial_comment', False):
comment = original_aa[prof][prof]['initial_comment']
comment.replace('\\n', '\n')
data.append(comment + '\n')