2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-29 13:28:19 +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
This commit is contained in:
Christian Boltz 2018-06-09 14:26:18 +02:00
parent 288ae9049a
commit 469eb444de
No known key found for this signature in database
GPG Key ID: C6A682EA63C82F1C

View File

@ -1893,11 +1893,9 @@ def save_profiles():
else: else:
oldprofile = get_profile_filename(which) oldprofile = get_profile_filename(which)
try: serialize_options = {}
newprofile = serialize_profile_from_old_profile(aa[which], which, '') serialize_options['METADATA'] = True
except AttributeError: newprofile = serialize_profile(aa[which], which, serialize_options)
# 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')
aaui.UI_Changes(oldprofile, newprofile, comments=True) aaui.UI_Changes(oldprofile, newprofile, comments=True)