utils: rewrite write_alias()

Merge remote-tracking branch 'cboltz/cboltz-rewrite-write_alias' from
Christian Boltz

Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
PR: https://gitlab.com/apparmor/apparmor/merge_requests/120/
This commit is contained in:
Steve Beattie 2018-05-08 08:26:20 -07:00
commit 6a2b90ba56
Failed to generate hash of commit

View file

@ -2665,7 +2665,16 @@ def write_change_profile(prof_data, depth):
return data
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):
data = []