mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
Merge branch 'utils_save_profiles' into 'master'
utils: fix and improve "save profiles" See merge request apparmor/apparmor!10 Acked-by: Tyler Hicks <tyhicks@canonical.com> for master and 2.11
This commit is contained in:
@@ -1823,16 +1823,20 @@ def save_profiles():
|
||||
if not changed:
|
||||
return
|
||||
|
||||
q.options = sorted(changed.keys())
|
||||
options = sorted(changed.keys())
|
||||
q.options = options
|
||||
|
||||
ans, arg = q.promptUser()
|
||||
|
||||
q.selected = arg # remember selection
|
||||
which = options[arg]
|
||||
|
||||
if ans == 'CMD_SAVE_SELECTED':
|
||||
profile_name = list(changed.keys())[arg]
|
||||
write_profile_ui_feedback(profile_name)
|
||||
reload_base(profile_name)
|
||||
write_profile_ui_feedback(which)
|
||||
reload_base(which)
|
||||
q.selected = 0 # saving the selected profile removes it from the list, therefore reset selection
|
||||
|
||||
elif ans == 'CMD_VIEW_CHANGES':
|
||||
which = list(changed.keys())[arg]
|
||||
oldprofile = None
|
||||
if aa[which][which].get('filename', False):
|
||||
oldprofile = aa[which][which]['filename']
|
||||
@@ -1848,7 +1852,6 @@ def save_profiles():
|
||||
aaui.UI_Changes(oldprofile, newprofile, comments=True)
|
||||
|
||||
elif ans == 'CMD_VIEW_CHANGES_CLEAN':
|
||||
which = list(changed.keys())[arg]
|
||||
oldprofile = serialize_profile(original_aa[which], which, '')
|
||||
newprofile = serialize_profile(aa[which], which, '')
|
||||
|
||||
|
Reference in New Issue
Block a user