mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 22:35:35 +00:00
write_piece(): remove always-True write_flags parameter
All the calling code (directly or indirectly) uses write_flags=True, therefore drop the parameter to simplify the code.
This commit is contained in:
@@ -2059,7 +2059,7 @@ def parse_unix_rule(line):
|
||||
# XXX Do real parsing here
|
||||
return aarules.Raw_Unix_Rule(line)
|
||||
|
||||
def write_piece(profile_data, depth, name, nhat, write_flags):
|
||||
def write_piece(profile_data, depth, name, nhat):
|
||||
pre = ' ' * depth
|
||||
data = []
|
||||
wname = None
|
||||
@@ -2070,7 +2070,7 @@ def write_piece(profile_data, depth, name, nhat, write_flags):
|
||||
wname = name + '//' + nhat
|
||||
name = nhat
|
||||
inhat = True
|
||||
data += profile_data[name].get_header(depth, wname, False, write_flags)
|
||||
data += profile_data[name].get_header(depth, wname, False, True)
|
||||
data += profile_data[name].get_rules_clean(depth + 1)
|
||||
|
||||
pre2 = ' ' * (depth + 1)
|
||||
@@ -2088,7 +2088,7 @@ def write_piece(profile_data, depth, name, nhat, write_flags):
|
||||
if not profile_data[hat]['external']:
|
||||
data.append('')
|
||||
|
||||
data += profile_data[hat].get_header(depth + 1, only_hat, True, write_flags)
|
||||
data += profile_data[hat].get_header(depth + 1, only_hat, True, True)
|
||||
|
||||
data += profile_data[hat].get_rules_clean(depth + 2)
|
||||
|
||||
@@ -2100,7 +2100,7 @@ def write_piece(profile_data, depth, name, nhat, write_flags):
|
||||
for hat in all_childs:
|
||||
if name == nhat and profile_data[hat].get('external', False):
|
||||
data.append('')
|
||||
data += list(map(lambda x: ' %s' % x, write_piece(profile_data, depth - 1, name, nhat, write_flags)))
|
||||
data += list(map(lambda x: ' %s' % x, write_piece(profile_data, depth - 1, name, nhat)))
|
||||
data.append(' }')
|
||||
|
||||
return data
|
||||
@@ -2113,7 +2113,6 @@ def serialize_profile(profile_data, name, options):
|
||||
raise AppArmorBug('serialize_profile(): options is not a dict: %s' % options)
|
||||
|
||||
include_metadata = options.get('METADATA', False)
|
||||
include_flags = options.get('FLAGS', True)
|
||||
|
||||
if include_metadata:
|
||||
string = '# Last Modified: %s\n' % time.asctime()
|
||||
@@ -2137,14 +2136,14 @@ def serialize_profile(profile_data, name, options):
|
||||
comment = original_aa[prof][prof]['initial_comment']
|
||||
comment.replace('\\n', '\n')
|
||||
data += [comment + '\n']
|
||||
data += write_piece(split_to_merged(original_aa), 0, prof, prof, include_flags)
|
||||
data += write_piece(split_to_merged(original_aa), 0, prof, prof)
|
||||
else:
|
||||
if profile_data[name].get('initial_comment', False):
|
||||
comment = profile_data[name]['initial_comment']
|
||||
comment.replace('\\n', '\n')
|
||||
data += [comment + '\n']
|
||||
|
||||
data += write_piece(profile_data, 0, name, name, include_flags)
|
||||
data += write_piece(profile_data, 0, name, name)
|
||||
|
||||
string += '\n'.join(data)
|
||||
|
||||
|
Reference in New Issue
Block a user