mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
rewrite write_alias()
Instead of calling write_pair() (which is quite complex because it needs to handle multiple rule types), write the alias rules directly in write_alias(). This comes with minor code duplication, but makes the code much more readable (3 instead of 7 %s)
This commit is contained in:
parent
eca16ae6cf
commit
3ee6058050
1 changed files with 10 additions and 1 deletions
|
@ -2664,7 +2664,16 @@ def write_change_profile(prof_data, depth):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def write_alias(prof_data, depth):
|
def write_alias(prof_data, depth):
|
||||||
return write_pair(prof_data, depth, '', 'alias', 'alias ', ' -> ', ',', quote_if_needed)
|
pre = ' ' * depth
|
||||||
|
data = []
|
||||||
|
|
||||||
|
if prof_data['alias']:
|
||||||
|
for key in sorted(prof_data['alias'].keys()):
|
||||||
|
data.append('%salias %s -> %s,' % (pre, quote_if_needed(key), quote_if_needed(prof_data['alias'][key])))
|
||||||
|
|
||||||
|
data.append('')
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
def write_rlimits(prof_data, depth):
|
def write_rlimits(prof_data, depth):
|
||||||
data = []
|
data = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue