mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-28 12:58:07 +00:00
serialize_profile: simplify setting of include_flags
Note that NO_FLAGS was an inverse option, therefore - NO_FLAGS was changed to FLAGS (also in sync_profile() which is the only caller that sets FLAGS) - the default for include_flags (if FLAGS is not set) is True
This commit is contained in:
parent
9865e112f7
commit
b613860f14
@ -740,7 +740,7 @@ def sync_profile():
|
|||||||
aaui.UI_Important(_('WARNING: Error synchronizing profiles with the repository:\n%s\n') % ret)
|
aaui.UI_Important(_('WARNING: Error synchronizing profiles with the repository:\n%s\n') % ret)
|
||||||
else:
|
else:
|
||||||
users_repo_profiles = ret
|
users_repo_profiles = ret
|
||||||
serialize_opts = {'NO_FLAGS': True}
|
serialize_opts = {'FLAGS': False}
|
||||||
for prof in sorted(aa.keys()):
|
for prof in sorted(aa.keys()):
|
||||||
if is_repo_profile([aa[prof][prof]]):
|
if is_repo_profile([aa[prof][prof]]):
|
||||||
repo_profiles.append(prof)
|
repo_profiles.append(prof)
|
||||||
@ -2664,16 +2664,13 @@ def write_piece(profile_data, depth, name, nhat, write_flags):
|
|||||||
|
|
||||||
def serialize_profile(profile_data, name, options):
|
def serialize_profile(profile_data, name, options):
|
||||||
string = ''
|
string = ''
|
||||||
include_flags = True
|
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
if type(options) is not dict:
|
if type(options) is not dict:
|
||||||
raise AppArmorBug('serialize_profile(): options is not a dict: %s' % options)
|
raise AppArmorBug('serialize_profile(): options is not a dict: %s' % options)
|
||||||
|
|
||||||
include_metadata = options.get('METADATA', False)
|
include_metadata = options.get('METADATA', False)
|
||||||
|
include_flags = options.get('FLAGS', True)
|
||||||
if options.get('NO_FLAGS', False):
|
|
||||||
include_flags = False
|
|
||||||
|
|
||||||
if include_metadata:
|
if include_metadata:
|
||||||
string = '# Last Modified: %s\n' % time.asctime()
|
string = '# Last Modified: %s\n' % time.asctime()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user