mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-03 07:45:50 +00:00
use serialize_profile() for the new profile in (V)iew Changes
... instead of serialize_profile_from_old_profile()
This will give a realistic preview of the changes (serialize_profile()
is also used when actually writing the profile) and replaces the
known-buggy serialize_profile_from_old_profile() with known-working
code.
It also fixes the issue reported in
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1528139
which means we no longer need the workaround of catching AttributeError
(verified in manual before/after test)
References:
- https://bugs.launchpad.net/apparmor/+bug/1394788
- https://bugs.launchpad.net/bugs/1528139
- https://bugs.launchpad.net/apparmor/+bug/1404893
(cherry picked from commit 469eb444de
)
This commit is contained in:
@@ -1869,11 +1869,9 @@ def save_profiles():
|
||||
else:
|
||||
oldprofile = get_profile_filename(which)
|
||||
|
||||
try:
|
||||
newprofile = serialize_profile_from_old_profile(aa[which], which, '')
|
||||
except AttributeError:
|
||||
# see https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1528139
|
||||
newprofile = "###\n###\n### Internal error while generating diff, please use '%s' instead\n###\n###\n" % _('View Changes b/w (C)lean profiles')
|
||||
serialize_options = {}
|
||||
serialize_options['METADATA'] = True
|
||||
newprofile = serialize_profile(aa[which], which, serialize_options)
|
||||
|
||||
aaui.UI_Changes(oldprofile, newprofile, comments=True)
|
||||
|
||||
|
Reference in New Issue
Block a user