mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 13:58:22 +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:
@@ -79,7 +79,7 @@ user_globs = {}
|
|||||||
transitions = {}
|
transitions = {}
|
||||||
|
|
||||||
aa = {} # Profiles originally in sd, replace by aa
|
aa = {} # Profiles originally in sd, replace by aa
|
||||||
original_aa = hasher()
|
original_aa = {}
|
||||||
|
|
||||||
changed = dict()
|
changed = dict()
|
||||||
created = []
|
created = []
|
||||||
@@ -97,7 +97,7 @@ def reset_aa():
|
|||||||
aa = {}
|
aa = {}
|
||||||
include = dict()
|
include = dict()
|
||||||
active_profiles = ProfileList()
|
active_profiles = ProfileList()
|
||||||
original_aa = hasher()
|
original_aa = {}
|
||||||
|
|
||||||
|
|
||||||
def on_exit():
|
def on_exit():
|
||||||
@@ -1625,7 +1625,7 @@ def read_profiles(ui_msg=False, skip_profiles=()):
|
|||||||
|
|
||||||
global aa, original_aa
|
global aa, original_aa
|
||||||
aa = {}
|
aa = {}
|
||||||
original_aa = hasher()
|
original_aa = {}
|
||||||
|
|
||||||
if ui_msg:
|
if ui_msg:
|
||||||
aaui.UI_Info(_('Updating AppArmor profiles in %s.') % profile_dir)
|
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
|
# 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)):
|
for prof in sorted(active_profiles.profiles_in_file(prof_filename)):
|
||||||
if prof != name:
|
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 = original_aa[prof][prof]['initial_comment']
|
||||||
comment.replace('\\n', '\n')
|
comment.replace('\\n', '\n')
|
||||||
data.append(comment + '\n')
|
data.append(comment + '\n')
|
||||||
|
Reference in New Issue
Block a user