move write_alias to ProfileList

It's only needed in the preamble, which makes ProfileList the perfect
place.
This commit is contained in:
Christian Boltz 2020-05-10 17:40:53 +02:00
parent fc6bd72781
commit 8855c60f23
Failed to generate hash of commit
2 changed files with 13 additions and 13 deletions

View file

@ -14,7 +14,7 @@
from apparmor.aare import AARE
from apparmor.common import AppArmorBug, AppArmorException, type_is_str
from apparmor.profile_storage import write_alias
from apparmor.rule import quote_if_needed
from apparmor.rule.abi import AbiRule, AbiRuleset
from apparmor.rule.include import IncludeRule, IncludeRuleset
@ -175,3 +175,15 @@ class ProfileList:
raise AppArmorBug('%s not listed in ProfileList files' % filename)
return self.files[filename]['profiles']
def write_alias(prof_data, depth):
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

View file

@ -218,18 +218,6 @@ def write_list_vars(ref, depth):
return data
def write_alias(prof_data, depth):
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_includes(prof_data, depth):
pre = ' ' * depth
data = []